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@[]>
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

   Adverb Information
Received on Saturday, 9 May 1998 14:56:40 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:26:47 UTC