gpt4 book ai didi

python - Flask 和 css 引用静态文件

转载 作者:太空宇宙 更新时间:2023-11-04 05:42:04 25 4
gpt4 key购买 nike

我有一个基本的 flask 应用程序,我在我的 css 文件中引用背景图像,就像这样

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

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

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

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

最佳答案

将您的 css 更改为此,然后重试:

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

关于python - Flask 和 css 引用静态文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33575667/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com