如何引用我的css文件中的静态文件? [英] How to refer to static files in my css files?
本文介绍了如何引用我的css文件中的静态文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的CSS文件中有一个引用静态图像的引用:
I have a reference inside my CSS file that refers to a static image:
#logo
{
background: url('/static/logo.png')
}
这在我的开发机器上工作正常,但不在我的生产环境中,因为url应该是static.mydomain.com/logo.png。
如何根据我的设置文件中的STATIC_URL动态更改css文件?
This works just fine on my dev machine but not on my production environment since the url should be static.mydomain.com/logo.png. How do I dynamically change the css file according to the STATIC_URL in my settings file?
推荐答案
使用相对路径。相对于css文件所在的文件夹
Use a relative path. Relative to the folder where the css file reside
这篇关于如何引用我的css文件中的静态文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文