Style IDs?

Discussion in 'CSS' started by extrickster, Jan 7, 2011.

  1. #1
    I read that style IDs are supposed to be entirely unique and you can only use them once per page as apposed to style classes. Is this true? If so then why can I use it two, three, four, or more per page?

    Thank you for your help,
    extrickster
     
    Last edited: Jan 7, 2011
    extrickster, Jan 7, 2011 IP
  2. wwwbryan

    wwwbryan Well-Known Member

    Messages:
    181
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    103
    #2
    An ID can only be used once per page, a class can be used multiple times.

    If you use more than one of the same ID on the same page the page will not be valid.
     
    wwwbryan, Jan 7, 2011 IP
  3. extrickster

    extrickster Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Oh okay I see, when I used the style ID "mom" twice it caused an error by the w3 validator service.
     
    extrickster, Jan 7, 2011 IP
  4. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #4
    Nothing happens to your layout on browser. It won't just validate against the W3C Validation. However, a class (.mom) can be used as many times you need. Read W3C specifications for more informations.
     
    radiant_luv, Jan 9, 2011 IP