[Javascript] how to refer to (x)html elements

Chris Tifer christ at saeweb.com
Thu Nov 13 12:34:33 CST 2003

----- Original Message ----- 
From: "David Lovering" <dlovering at gazos.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Thursday, November 13, 2003 12:45 PM
Subject: Re: [Javascript] how to refer to (x)html elements

> On the other matter, CSS was designed to provide * reproducible * style
> elements, i.e; ones which are intended to be applied to more than one
> object.  Having a style element which can properly be attached to one and
> only one object sort of voids the mission directive, don't you think?  It
> unfortunate that they chose "ID" as the attribute to communicate the style
> element to the object.  On that issue I believe Hassan and I are in
> agreement.  [While "CLASS" does demonstrably work in a similar capacity on
> some browsers, the lack of uniformity is still problematic].

Check my last response to this, but there's a very good use for ID to a
style sheet that will apply to only one particular object (per document).
For instance, news sites. They have Headlines on their news stories. If you
want all Headlines to look similar, you use a linked style sheet that
defines Headlines. That doesn't mean that there's multiple headlines on a
page though.

While they could just as easily define one particular instance with a class,
sometimes it's just cleared to have one particular ID.

I might be mistaken and the CSS docs specifically say that IDs should be
used if there's going to be multiple ones, but I would imagine they
recommend you to use classes if you're going to have similar elements on a
single document.

Chris Tifer

More information about the Javascript mailing list