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 ?
这里的scriptlet
and~
是特定于 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')
这就是解决我的问题的方法
background: url(../../../image.png)