0

如何在一个模板中使用另一个 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 %}

这可能吗?

4

1 回答 1

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 %}
于 2013-03-14T12:15:29.967 回答