0

I separate the css from the *.aspx file. When this

background-image: url('<%=Page.ResolveUrl("~/Themes/Red/Images/Contestant/1.jpg)%>';)

was in the aspx file it worked, and now it's not working.

do you know any other way ?

4

2 回答 2

3

这里的scriptletand~是特定于 aspx 文件的,不能在 css 中使用。

改变

background-image: url('<%=Page.ResolveUrl("~/Themes/Red/Images/Contestant/1.jpg)%>';)

background-image: url('/Themes/Red/Images/Contestant/1.jpg')

以上假设 Themes 文件夹位于您网站的根目录。

给出相对于的路径css

background-image: url('Themes/Red/Images/Contestant/1.jpg')
于 2013-04-10T07:55:22.270 回答
0

这就是解决我的问题的方法

background: url(../../../image.png)
于 2013-04-10T08:44:51.810 回答