【问题标题】:Flask and css reference to static filesFlask 和 css 对静态文件的引用
【发布时间】:2015-11-06 21:02:34
【问题描述】:

我有一个基本的烧瓶应用程序,我在我的 css 文件中引用背景图像,如下所示

.three {
  background:url('/static/images/house.jpg');
}

我的文件夹组织是这样的:

project
    app.py
    -static
        -images
            house.jpg
        -css
            index.css
    -templates
        index.html

如何让我的 css 正确调用图像?

【问题讨论】:

  • 它不能按原样工作吗?
  • 由于某种原因它没有拾取图像,其他一切正常
  • 实际上我的文字也有白色背景,所以也许css不是问题......

标签: python html css flask


【解决方案1】:

把你的css改成这个,然后再试一次:

.three {
  background-image: url('images/house.jpg');
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-04
    • 2013-10-09
    • 1970-01-01
    • 2014-02-22
    • 2011-08-19
    • 1970-01-01
    • 2012-07-06
    相关资源
    最近更新 更多