[thelist] DIV IDs

sasha spam at bittersweet2.com
Sun Dec 29 16:15:01 CST 2002

On Sun, 29 Dec 2002 22:06:22 -0000, Daniel Fascia
<danfascia at totalise.co.uk> wrote:

> Im confused...
> Do IDs in DIVs absolutely have to be unique throughout a page?
> 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??
> could someone kindly explain...
> thanks
> Dan

Technically, you are using id's incorrectly (a validator should pick this
up, or at least it used to).  An id is meant to be unique, since it is used
for more than just CSS (bookmark links use ids in place of a "name" in
XHTML).  You should use a class for your structure, since it will be
repeated, and then use an id to make it a particular color.


More information about the thelist mailing list