Previous Message
Next Message

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

Sent by Ian Leckie on 31 January 2002 09:09

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.
>> ID is a unique selector. . .you can only use a particular value for and ID
>> once on a page.
> The current browsers don't actually mind if you reuse an ID value on a
> page for styling multiple elements, but it is unwise to rely on that
> behavior.

perhaps not, but it's not valid to have multiple cases of a single ID on the
same page, going back at least as far as html 3.2.

Ian Leckie
Interactive Developer
The Integer Group
p: 515.247.2646
c: 515.988.6003
Previous Message
Next Message

Message thread: