SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Img Id's

  1. #1
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,374
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    Hi,

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

    Change it to:
    Code:
    img#img-25{
        float: right;
    }

  3. #3
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Duh! Should have tested for that first. Thanks for the help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •