[thelist] DIV IDs

Lachlan Cannon luminosity at members.evolt.org
Sun Dec 29 19:23:01 CST 2002


Daniel Fascia wrote:
> I have a page with many (4) #box objects which all use the same formatting
> structure but differ in colour. I've used the ID to mark up the basic form of
> the boxes and the class to vary the colour of each on the page.
>
> Am I using IDs and classes incorrectly here??

Yep, IDs must be unique within a page, but classes do not have to be.
Apart from anything else IDs have to be unique because they serve more
purposes than just CSS: They are also used to make anchors, in
replacement of <a name=""/>, and are used in scripting to grab elements
using document.getElementById(); and having more than one of the same ID
will really screw you round when you're trying to work with this stuff.
--
Lach
__________________________________________
Web: http://illuminosity.net/
E-mail: lach @ illuminosity.net
MSN: luminosity @ members.evolt.org
__________________________________________





More information about the thelist mailing list