我正在本地主机上进行开发- localhost/mysite ,其中具有以下目录结构:
I am developing on my localhost - localhost/mysite, and within that I have the following directory structure:
-assets --css ---styles.css --images ---background.png在styles.css文件中,我将得到以下内容,在localhost上可以正常使用
Within the styles.css file, I would have something the following, which works fine on localhost
background-image: url(../images/background.png);但是,实时服务器在一个子域上运行- test.liveserver .这意味着css规则必须进行如下更改:
However, the live server works off a subdomain - test.liveserver. This means that the css rule has to change as follows:
background-image: url(/assets/images/loginlogo.png);不确定要解决此问题的最佳方法吗?
Not sure on the best way to get around this?
推荐答案通过提供的目录树,您不必更改路径.
With the directory tree you are providing you don't have to change your path.
..表示CSS文件的父目录,因此暗指assets/目录.
.. means the parent directory of the CSS file so the assets/ directory is implied.
更多推荐
图片的CSS相对网址
发布评论