W3C home > Mailing lists > Public > www-style@w3.org > May 1998

Re: Class and ID

From: Bert Bos <bbos@charlotte.inria.fr>
Date: Sun, 10 May 1998 12:49:28 +0200
Message-Id: <199805101049.MAA08793@charlotte.inria.fr>
To: www-style@w3.org
chimbis@bahnhof.se writes:
 > On Sat, 9 May 1998 21:48:47 -0700, you wrote:
 > 
 > >The only answer I can come up
 > >with is something like "because it would be dishonest to represent a unique
 > >instance of something as belonging to a class of things." 
 > 
 > That seems to make sence.
 > 
 > >From an
 > >effect-oriented CSS author's point of view, the distinction may be
 > >irrelevant, but from a markup point of view, it's a question of integrity.
 > 
 > I'm still on the effect-oriented level so I agree with you here.
 > Thanks, I can go on reading.

There is also the difference in the "specificity" in the cascading
order. Take this document:

    <style>
      #very-special {color: red}
      P.special {color: blue}
    </style>
    <p class=special>Some special par
    <p class=special id=very-special>Some VERY special par
    <p class=special>Some special par

Because an ID singles out a unique element, it is considered to be
more specific than a class, and it will take precedence over any other
rules. The 2nd par above will thus be red.



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Sunday, 10 May 1998 06:50:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:55 GMT