gpt4 book ai didi

jquery - 背景/背景图像不起作用?

转载 作者:行者123 更新时间:2023-11-28 04:04:20 24 4
gpt4 key购买 nike

我正在练习构建一个哈雷戴维森网站,我遇到了一个关于“背景”和“背景图像”的奇怪问题。

控制台不断出现404类型的错误:

(anonymous) @ jquery.min.js:2
i @ jquery.min.js:2
fireWith @ jquery.min.js:2
ready @ jquery.min.js:2
K @ jquery.min.js:2
jquery.min.js:2 GET file:///Users/benjamingibbs/Desktop/Harley%20Davidson/css/images/austin-neill-174636.jpg net::ERR_FILE_NOT_FOUND

文件路径没有问题。当我在 div 中使用“img”标签时,图像会加载, Logo 也会出现在同一目录中。

.jumbotron {
background: url("images/austin-neill-174636.jpg");
}

为什么图像没有出现?

  • 也尝试了“body”“background:”,但没有成功。

最佳答案

您的图像文件夹是否与您的 css 文件位于同一文件夹中?因为如果没有,您的网址应如下所示:

background: url("../images/austin-neill-174636.jpg");

包含 ../ 将当前文件夹转义到主元素目录中的图像文件夹。

关于jquery - 背景/背景图像不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43029067/

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