Django 正文{background:rgba(240234234,0.897)url(";images/background.gif";)无重复;}
模板代码Django 正文{background:rgba(240234234,0.897)url(";images/background.gif";)无重复;},django,Django,模板代码 {%load static%} {%if最新问题列表%} {最新问题列表%中的问题% {%endfor%} {%else%} 没有投票 {%endif%} CSS代码 li a { color: rgb(13, 238, 43); } body { background: rgba(240, 234, 234, 0.897) url("images/background.gif") no-repeat; } polls/static/im
{%load static%}
{%if最新问题列表%}
{最新问题列表%中的问题%
{%endfor%}
{%else%}
没有投票
{%endif%}
CSS代码
li a {
color: rgb(13, 238, 43);
}
body {
background: rgba(240, 234, 234, 0.897) url("images/background.gif") no-repeat;
}
polls/static/images/background.gif中有一个background.gif
除背景图像外,所有样式都在浏览器中正确显示
原因可能是什么?谢谢你的帮助
url()CSS函数用于包含一个文件。该参数是一个
绝对URL、相对URL或数据URI
在您的设置中定义STATIC\u URL='/STATIC/'
,那么URL('/STATIC/images/background.gif')
可能会起作用,或者您可以使用URL({{STATIC\u URL}}images/background.git
,注意:{STATIC\u URL}}}之后没有反斜杠
在这里阅读更多