背景图片URL路径

时间:2018-04-13 06:51:48

标签: html css

我正在尝试使用CSS为我的页面设置背景。图像来自另一个文件夹,我试图在CSS文件中引用该图像。

CSS文件URL是/ vowel-temp / administrator / templates / vowel / css。

图像文件URL为/ vowel-temp / administrator / templates / vowel / images / icons。

为什么我看不到自己的背景图片?

ul#menu li:first-child a:before{ background-image: url("../images/icons/01-dashboard.png"); }

3 个答案:

答案 0 :(得分:0)

只需将此作为您的网址使用:" /images/vowel/imagename.jpeg"。 你可能正在使用整个路径,这可能是你错误的原因。!

答案 1 :(得分:0)

这有用吗?

body {
    background-image: url("/images/vowel/imagename.jpeg");
}

为什么你要ul#menu li:first-child a:before作为你想要的风格?

答案 2 :(得分:0)

尝试从另一个元素开始,如果它正在工作

body {
    background-image: url("../images/icons/01-dashboard.png");
}

或将其添加到您的代码中。因为你正在使用:在伪元素之前

content: "";
position: absolute;
top: 0;
left: 0;
width: 150px;
height: 150px;

然后添加相对位置 ul#menu li:first-child a