是CSS文件中相对于CSS文件的相对路径吗? [英] Is a relative path in a CSS file relative to the CSS file?
本文介绍了是CSS文件中相对于CSS文件的相对路径吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我通过相对路径引用CSS文件中的图像或其他文件时,是相对于CSS文件还是使用CSS文件的HTML文件的路径?
When I reference an image or other file in a CSS file by a relative path, is the path relative to the CSS file or the HTML file using the CSS file?
推荐答案
是的,它是相对于 .css
示例布局:
Page: page.htm ... does not matter where
CSS: /resources/css/styles.css
Image: /resources/images/image.jpg
c $ c> styles.css :
CSS in styles.css
:
div { background-image: url('../images/image.jpg');
这篇关于是CSS文件中相对于CSS文件的相对路径吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文