CSS question: id == class?

Discussion in 'XML' started by Xah Lee, Jan 28, 2005.

  1. Xah Lee

    Xah Lee Guest

    In CSS, what's the difference between "id=" and "class="?

    i thought id is CSS2 version equivalent for a shorter name. But
    apparently if i replace class with id on a webpage they don't work...
    thanks.

    Xah

    http://xahlee.org/PageTwo_dir/more.html
    Xah Lee, Jan 28, 2005
    #1
    1. Advertising

  2. Bjoern Hoehrmann, Jan 28, 2005
    #2
    1. Advertising

  3. Xah Lee

    Peter Flynn Guest

    Xah Lee wrote:

    >
    > In CSS, what's the difference between "id=" and "class="?
    >
    > i thought id is CSS2 version equivalent for a shorter name. But
    > apparently if i replace class with id on a webpage they don't work...
    > thanks.


    ID values must be unique per document. They identify a single object.
    That's why they're called "IDs".

    Class values can occur arbitrarily.

    ///Peter
    --
    "The cat in the box is both a wave and a particle"
    -- Terry Pratchett, introducing quantum physics in _The Authentic Cat_
    Peter Flynn, Jan 28, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric
    Replies:
    4
    Views:
    687
    clintonG
    Dec 24, 2004
  2. E11
    Replies:
    1
    Views:
    4,683
    Thomas Weidenfeller
    Oct 12, 2005
  3. Replies:
    6
    Views:
    530
    Jonathan N. Little
    Mar 18, 2006
  4. AF
    Replies:
    17
    Views:
    573
    Nije Nego
    Aug 9, 2006
  5. richard
    Replies:
    12
    Views:
    731
    dorayme
    Mar 9, 2010
Loading...

Share This Page