How to reference embedded images from CSS?

<% = WebResource("image1.jpg") %>

You can use above statement inside your CSS file, and while you register your CSS with
WebResourceAttribute, you can set “PerformSubstitution” to true

Default.css
body{
    background: <%=WebResource("xyz.jpg")%>
}



[assembly, WebResource("Default.css","text/css", PerformSubstitution=true)]
[assembly, WebResource("xyz.jpg","image/jpg")]

Leave a Comment

tech