2

Does the 'Id' attribute work the same for apex elements as it does for html elements?

The anchor tag below, gets the background image, but the outputlink does not.

Am I doing somthing wrong? Can this be fixed?

.dm_lp_imgs{
    width: 100px;
    float:left;
    height: 115px;
    margin-right: 15px;
} 


#myId{
    background: url('{! URLFOR($Resource.folder, 'imgs/image.png') }') left top no-repeat;
}


<apex:outputLink id="myId" styleClass="dm_lp_imgs" target="_top" value=""> </apex:outputLink>


<a id="myId" class="dm_lp_imgs"></a>

Cheers!

1 Answer 1

3

Apex tags automatically generate strings for the IDs unless all of the parent DOM structure have IDs defined as well. In that case it would be something like bodyID:formID:elementID. For this scenario I'd suggested using a class for your CSS as its best practice anyway.

1
  • Chhers Phil B, appreciate the informative response!
    – Daft
    Jun 18, 2014 at 8:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .