我有一个css文件链接到滑块的一些图像,我想更改绝对路径的相对路径
background: url(../img/bg.png) no-repeat 0 0;
我使用了以下内容,因为img文件夹位于网站的根文件夹中,但它不起作用。这里有什么我想念的吗?当我将图像复制到images文件夹并使用images / bp.png也不起作用?
background: url(img/bg.png) no-repeat 0 0;
我试过
background: url(/img/bg.png) no-repeat 0 0; and it still doesn't work
答案 0 :(得分:0)
是的,要获得root,你的CSS应该是这样的
background: url(/img/bg.png) no-repeat 0 0;
URL开头的斜杠会将您带到根目录。没有斜线,它会在CSS文件所在的同一文件夹中查找图像