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

Re: Class and ID

From: Carl Johan Berglund <carl.johan.berglund@adverb.se>
Date: Sat, 9 May 1998 20:54:31 +0200
Message-Id: <l03102802b17a562bc488@[195.42.193.67]>
To: chimbis@bahnhof.se (Martin Skjöldebrand )
Cc: www-style@w3.org
At 20.29 +0200 98-05-08, Martin Skjöldebrand wrote:
>I've been reading the book on Cascading Style Sheets by Lie and Bos.
>Could someone please explain the difference between .class and #id,
>and give an example of when one would like to use one instead of the
>other? Perhaps I'm a bit thick but I don't really get the difference.

An id has to be unique in a document, while several elements can belong to
the same class. Hence, id should only be used when you want to manipulate
the style of one certain piece of the document, and only that, while class
can be used with more than one piece of the document.

I don't see a case when you can use an id and can not use a class, though.

Vänliga hälsningar
Carl Johan Berglund


___Carl_Johan_Berglund_________________________
   Adverb Information
   carl.johan.berglund@adverb.se
   http://www.adverb.se/
Received on Saturday, 9 May 1998 14:56:40 GMT

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