我无法找出在我的 CSS 文件中使用的正确路径
html { background-image: url('backgroundImage.jpg'); }
我的文件夹结构如下:
..\MySite\ <!-- HTML files here -->
..\MySite\css\
..\MySite\js\
..\MySite\images\ <!-- backgroundImage.jpg here -->
最佳答案
html{ background-image: url('../images/backgroundImage.jpg'); }
../
告诉您的 CSS 文件返回一个目录并从该文件夹(在本例中为您的根文件夹)搜索图像
关于css - 将 CSS 链接到子文件夹中的图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13893878/