如何在一个模板中使用另一个style.css?

时间:2013-03-14 12:10:10

标签: django

如何在一个模板中使用另一个style.css?

例如:

{% extends "base.html" %}
{% block content %}
<p>Here I need to use another css file (not the same like on base.html)</p>

{% endblock %}

这可能吗?

1 个答案:

答案 0 :(得分:3)

<强> base.html文件

<html> 
<head>
    <title>{% block title %}{% endblock %}</title>
    {% block css %}{% endblock css %}
</head>
<body>
    {% block content %}{% endblock content %}
</body> 
</html>  

其他模板

{% extends "base.html" %}

{% block css %}
    {{block.super}}
    //css here
{% endblock css %}

{% block content %}
<p>Here I need to use another css file (not the same like on base.html)</p>

{% endblock content %}