【发布时间】:2018-09-29 07:16:27
【问题描述】:
我的背景图片没有通过我的 CSS 文件加载。它通过前端加载:
<img class="top" src={% static "/store/img/store.jpg" %}>
在 div 内部但不包含: background: url('{{ STATIC_URL }}/store/img/store.jpg');在 css 文件上。
我的路径是apps/store/static/store/img/store.jpg,这样很好。
HTML:
<div class="w3-display-container w3-content w3-wide" style="max-width:1600px;min-width:500px" id="home">
<div class="w3-display-bottomleft w3-padding-large w3-opacity">
<h1>SAN MIGUEL'S EXPORTA</h1>
</div>
</div>
CSS:
#home{
/* The image used */
background: url('{{ STATIC_URL }}/store/img/store.jpg') no-repeat;
/* Full height */
height: 100%;
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: center;
background-size: cover;
}
【问题讨论】:
标签: python css django background-image