从CSS链接加载背景图片时获取404

时间:2019-06-08 03:28:02

标签: html css

我正在尝试加载背景图片loader.gif以在页面之间运行

出现此错误:

"POST /analyze HTTP/1.1" 200 -

"GET / HTTP/1.1" 200 -

"GET /static/css/static/images/loader.gif HTTP/1.1" 404 -

这是我的代码:

@charset "utf-8";
#child {
  line-height: 675px;
  text-align: center;
  font-size: large;
  color: grey;
}

div#loading {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 500px;
  height: 500px;
  display: none;
  background: url(/images/loader.gif) no-repeat;
  cursor: wait;
}
<html>

<head>
  <script type="text/javascript">
    // <![CDATA[
    function loading() {
      $("#loading").show();
      $("#content").hide();
    }
    //]]&gt
  </script>
  <meta charset="utf-8">
  <div id="loading">
    <div id="child">Loading...</div>
  </div>

  <link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='css/custom.css') }}">
</head>

<body>
  <div id="content">
    <h2>content</h2>
  </div>
</body>

</html>

我不明白的是错误日志如何将路径显示为/static/css/static/images/loader.gif

当我指定的路径是/static/images/loader.gif

该文件来自根目录中的静态文件夹

目录结构

root
|___Static
| |___css
| |  |___bootstrap.css
| |  |___custom.css
| |
| |___images
| |  |___loader.gif
| |  |___logo.png
| |
| |___favicon.ico
|
|___templates
| |___index.html
| |___results.html
|
|___main.py
|___requirements.txt

0 个答案:

没有答案