Img Id's

I’m having a problem with using an id attribute on an img tag. This is the img tag:

<img src=“images/25off.jpg” width=“159” height=“174” alt=“coupon” id=“25off”/>

And this is the CSS rule:

img#25off{
float: right;
}

So why doesn’t this work? Seems simple enough.

-confused and curious :confused:

Hi,

You can’t start an ID with a number as it’s invalid and won’t be recognised.

Change it to:


img#img-25{
    float: right;
}

Duh! Should have tested for that first. Thanks for the help.