django template: Is extended template able to change css in parent page?

后端 未结 3 854
鱼传尺愫
鱼传尺愫 2021-02-04 18:51

I have two django template pages, one of them is \"base.html\", with basic html tags setup as a base template. Now I have a page \"child.html\" that extends it, with something l

3条回答
  •  说谎
    说谎 (楼主)
    2021-02-04 19:15

    In the main template:

    
    ...
    
    

    Then in the child template, just define the block:

    {% block body_class %} my_new_body_css_class {% endblock %}
    

    This will render a ... and you have to define this class in a linked CSS.

提交回复
热议问题