How to call static resource image in another static resource css file?.i save one image in static resource as a name flowerimage.then that flower image calling from css as a url($Resource.flowerimage, 'flowerimage.png').those css are in saved in another static resource file name as "cssstyles".then i am calling that css file in page but i am not getting image in page.how to call resource image in static resource css file.can anybody help me on this.
1 Answer
One solution (assuming you can re-organize the files) is to put both the images and CSS in a zip file that you then add as a static resource.
The image reference can then be relative e.g.:
url("../images/Sortbybutton.png")
so avoiding the need for the $Resource
reference (that can only be processed in a Visualforce page).
See e.g. How to refer my static resource zip file ( CSS & Img) in VF Page? for an example.
You can add the CSS to the page using e.g.:
<link href="{!URLFor($Resource.myzip, 'css/mycss.css')}" rel="stylesheet" />