Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 即使在使用url(';../../images/image.png';)时,背景图像路径也不起作用_Html_Css_Background Image - Fatal编程技术网

Html 即使在使用url(';../../images/image.png';)时,背景图像路径也不起作用

Html 即使在使用url(';../../images/image.png';)时,背景图像路径也不起作用,html,css,background-image,Html,Css,Background Image,我获取加载资源失败:当我给出背景图像路径时,服务器响应状态为404(未找到)错误,如图所示: body { background-image: url('../../images/img.png') !important; background-color: #d0dfe5 !important; background-repeat: repeat; font-size: 14px !important; } 我不知道我为什么会犯这个错误。在这条路上有什么我需要

我获取
加载资源失败:当我给出背景图像路径时,服务器响应状态为404(未找到)
错误,如图所示:

body {
    background-image: url('../../images/img.png') !important;
    background-color: #d0dfe5 !important;
    background-repeat: repeat;
    font-size: 14px !important;
}
我不知道我为什么会犯这个错误。在这条路上有什么我需要改变的吗?
请帮助我。

显示文件的屏幕截图

标题##`.bg{ }`

根据您的目录结构,您的图像位于比当前位置高一级而不是两级的文件夹中。这就是为什么您需要像假设的那样使用
。/
。/../


试试这个:
“../images/hrm\u taustakuvan\u verkko.png”
问题在于css中的路径

background-image: url('../../images/image.png') !important;
您位于“
personaltitania/WebContent/styles/personaltitania_base.css
”中,图像文件位于“
WebContent/images/
”,但使用“
。/../
”时返回两个级别,此时您尝试在“
personaltitania/images
”中找到图像“image.png”

试用

background-image: url('../images/image.png') !important;

而且,我在你的images文件夹中没有看到文件“image.png”

你的目录结构是什么样子的?MyProject->WebContent->images->image.pngI希望看到一张显示css和图像所在位置的图片,这样我就可以看到css如何访问图像(以url的形式)我已通过添加图像@miqdamirali编辑了我的问题。请回答我的问题,以便我可以接受:)
background-image: url('../images/image.png') !important;