Re: Class and ID

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 UTC