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
AndreaTAndreaT 

Styling several images in a VF page (newbie)

Hello, 
I'd like to use a set of icons in several VF pages in a force.com site and then apply a common style with a single css piece of code  (eg. in a static resource or a component). 

I use a code like <apex:image url="{!URLFOR($Resource.Images, 'xxx.gif')}"  /> to load each image. 
I'd suppose I should use a CSS ID, so I put an ID in the VF page code and in the CSS: 

VF page code example: 
<apex:stylesheet value="{!URLFOR($Resource.Stile, 'style.css')}" /> 
<apex:image url="{!URLFOR($Resource.Images, 'xxx.gif')}" id="abc"  /> 

style.css code example: 
#abc {float: right} 

I performed several tests but that doesn't work, and I cannot apply the same ID to more than 1 image.
Any suggestion? Thanks 

Best Answer chosen by Admin (Salesforce Developers) 
Edwin VijayEdwin Vijay

<apex:image url="{!URLFOR($Resource.Images, 'xxx.gif')}" styleclass="abc" />

 

You should use styleclass to reference classes defined in your CSS file... Hope that solves your problem