0
我正在运行django 1.5.1,我试图提供一些在我的css中定义的静态图像。我没有问题,在模板中定义的css本身和静态图像。在css中定义的样式也正确地应用于我的模板。唯一不起作用的是在CSS中定义的图像。Django提供在CSS文件中定义的静态图像
这是我的CSS文件的定义类,其包括静态图象的样品:
.outer_banner
{
background:url(/images/banner2.png) bottom center no-repeat;
padding:300px 0;
}
下面是使用在CSS中定义的类我的模板的一个例子:
{% load staticfiles %}
<!DOCTYPE html>
<html>
<head>
<link href="{% static 'css/style.css' %}" rel="stylesheet" type="text/css" />
<!-- more header stuff here -->
</head>
<body>
<section class="outer_banner">
<!-- other stuff here -->
</section>
</body>
</html>
谢谢!
非常感谢!这解决了问题。 – Belethia 2014-09-07 08:40:07