Forum Moderators: not2easy
<div class="foo" id="foo">bar</div>
#foo { color: red; }
.foo { color: blue; }
'bar' will show up in red, not blue, useful if you need to override other styles within a particular section of your layout.
Here Goes:
XML-defined stuff
But, id's also fall underneath a certain category of attribute, known as a "TokenizedType" (or the ID attribute), which requires, among other things, that each be unique, and that there be no more than one ID per element.
Read these 2 sections for the full-blown description: the XML spec should be read first:
XML spec:
[w3.org...]
XHTML spec:
[w3.org...]
On to the class issue:
XHTML + CSS
And yes, I am a dork. But I must say its totally ok to have id's and classes with the same name, even with case-sensitive standards.
(after the # and ., of course)
The two free downloadable chapters available from Zeldman's new book outline some interesting usage of ID's where at least I wouldn't have thought to use them before.
Check'em out thru:
www.newriders.com/
How's that for a clean link?
[edited by: Nick_W at 6:36 am (utc) on May 17, 2003]
[edit reason] Perfect! [/edit]