簡體   English   中英

即使使用url('../../ images / image.png'),背景圖片路徑也不起作用

[英]Background image path is not working even when I use url('../../images/image.png')

Failed to load resource: the server responded with a status of 404 (Not Found)當我給出背景圖像路徑時Failed to load resource: the server responded with a status of 404 (Not Found) ,如下所示:

body {
    background-image: url('../../images/img.png') !important;
    background-color: #d0dfe5 !important;
    background-repeat: repeat;
    font-size: 14px !important;
}

我不是出於什么原因收到此錯誤。 我有什么需要改變的道路嗎? 請幫我。

問題是您的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;

而且,我在您的圖片文件夾中看不到文件“ image.png”

根據目錄結構,圖像位於當前位置上一層而不是兩層的文件夾中。 這就是為什么您需要在../../使用../

試試這個: '../images/hrm_taustakuvan_verkko.png'

在文件上顯示屏幕截圖

標題##`.bg {

background: url('../img/banner3.jpg') no-repeat 60% 90%;
background-attachment: fixed;
background-size: 100% 100%;
position: fixed;
width:100%;
top:0;
left:0;

}` 我的文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM