我的CSS像这样链接:
{% stylesheets '@MyFrontendBundle/Resources/public/css/*' filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
此CSS文件中的背景图片:
#pic {background-image:url('../../bundles/myfrontend/images/pic.png');}
CSS和图像文件夹都在资源/ public /中。
背景图像只是不会显示。当我在浏览器中查找路径时,它显示
background-image:url('../../Resources/bundles/myfrontend/images/pic.png');
为什么它将资源添加到我的路径中?如果我将Firebug中的路径编辑回
background-image:url('../../bundles/myfrontend/images/pic.png');
正在显示背景。
我希望有人可以帮助我解决这个问题。
附注:问题在Linux上不存在。背景图像在那里显示。
最佳答案
尝试这个:
{% stylesheets '@MyFrontendBundle/Resources/public/css/*' filter='cssrewrite' %}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
编辑:
background-image:url('../../../bundles/myfrontend/images/pic.png');