Bit*_*map 5 css java spring spring-mvc
我使用Spring 3.0.7作为我的Web应用程序.我想从我的资源位置加载图像,如下所示:
.tag {
background: transparent url(/resources/img/bg.gif) no-repeat;
background-position: 0 50%;
padding-left: 50px
}
Run Code Online (Sandbox Code Playgroud)
我可以轻松地在jsp文件中加载我的静态资源,如下所示,没有任何问题:
<c:url value="/resources/css/main.css" />
Run Code Online (Sandbox Code Playgroud)
我的静态资源处理程序已配置如下:
<mvc:resources mapping="/resources/**" location="/web-resources/"/>
Run Code Online (Sandbox Code Playgroud)
如上所述,我可以在没有问题的情况下在jsp文件中加载资源,但无法在我的CSS中加载图像.任何人都可以帮助加载CSS文件中的图像!
小智 18
如果您的文件夹树是这样的:
+resources
-css
-main.css
-img
-lots_of_img.jpg
Run Code Online (Sandbox Code Playgroud)
然后就更容易了url('../img/bg.gif').
| 归档时间: |
|
| 查看次数: |
12474 次 |
| 最近记录: |