function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
anjisalesforce@gmail.comanjisalesforce@gmail.com 

How to get the resource images in CSS file

Hi all,

 

How to get the resource images in CSS file?

 

Please give me solution with Example....

 

Thanks for your Help

Chamil MadusankaChamil Madusanka

You cannot access static resources in CSS file same as the visualforce pages.

 

If you intend to use images in your stylesheet, zip the images with the CSS file and upload it as a single static resource. For
example, if your CSS file has a line like the following:

 

body { background-image: url("images/dots.gif") }

 
Add the entire images directory and the parent CSS file into a single zip. For example, if the zip file resource name is
myStyles, refer to it like this:

 

<apex:stylesheet value="{!URLFOR($Resource.myStyles, 'styles.css')}"/>

 If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.