Previous Message
Next Message

Re: [css-d] difference between class and id selectors

Sent by Rijk van Geijtenbeek on 31 January 2002 10:10


On Thursday, January 31, 2002, Ian wrote:
> On 1/31/02 3:22 AM, "Rijk van Geijtenbeek" [EMAIL-REMOVED]> wrote:

>>>> To put it another way, are there circumstances in which one would always
>>>> use an ID selector and not a CLASS selector (or vice versa)?

>> You could always use classes instead of ID, if you want to. ID is
>> only really needed when you want to reference an element in a script.

> or if you want to add additional styling to a single element that's already
> assigned a class, as per my example.

Not necessarly, you can also multiple classes for the same element.
<em class="note new">Note:</em>

.new {font-style: italic;}
.note {font-weight: bold; color: red;}

This works in IE6, Opera 6 and Mozilla. Not in Netscape 4.x and IE4. I
don't know in which version IE startin supporting this.

I'm not saying using ID isn't a good idea, just that it isn't really
needed for styling purposes.


Greetings,
 Rijk                            [EMAIL-REMOVED]

Mot du Jour:
Bombs don't kill people, explosions kill people.
Previous Message
Next Message

Message thread: