W3C home > Mailing lists > Public > www-style@w3.org > November 1997

Re: ID and CLASS (fwd)

From: eva <eva@algonet.se>
Date: Wed, 12 Nov 1997 11:03:00 +0100
To: <www-style@w3.org>
Message-ID: <01bcef52$28a3a020$LocalHost@eva>
MegaZone <megazone@livingston.com>


>Once upon a time Volker Kroll shaped the electrons to say...
>>its possibly up to me that I don't understand the difference between ID
and
>>CLASS. By now I think that ID is only for one occurence in a file and
CLASS
>>for more occurences. Is this correct, or do I misunderstand the spec.

>ID - holds ONE and only one value.  And that value must be unique in the
>document.
>CLASS - can hold a LIST of values, and these values can be repeated on
>other elements.

The term 'value' can be somewhat misunderstood here. ID identifies and sets
style to one and only one occurrence of an element while class can be
attached to any number of elements. By singling out one occurrence of an
element  the unique value can be declared to said element. However, ID can
be declared shorthand property which holds a number of values as well as
more than one property each holding one or more values.


#eva1 {background: red; color: white}

<ELEMENT ID=eva1>This and ONLY THIS occurrence of the ELEMENT element can be
identified as eva1</ELEMENT>
<ELEMENT2 ID=eva1>This element CANNOT be identified as eva1</ELEMENT2>

.eva2 {background: red; color: white}

<ELEMENT class=eva2>This and any other element can be classified as
eva2</ELEMENT>
<ELEMENT2 class=eva2>This element can also be classified as eva2</ELEMENT2>
/e
Received on Wednesday, 12 November 1997 05:02:38 GMT

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