[Answer]-Django template inheritance – markup CSS class

1👍

You can define a block inside the <body> tag:

<html>
    <head>...<head>
    <body {% block body_options %}{% endblock %}>
        {% block one %}{% endblock %}
        {% block two %}{% endblock %}
        {% block extra %}{% endblock %}
    </body>
</html>

Then, in your child templates,

{% extends 'master.html' %}
{% block body_options %}class="front"{% endblock %}
👤xjtian

Leave a comment