On Mon, 10 Nov 2008 11:31:30 -0500, [EMAIL PROTECTED] wrote: > > Sorry if this is a little bit out of left field, but I was looking over a > colleague's > work today, and I noted that he should be using IDs instead of classes for > elements > which appear once on a page. > > He told me that he had modeled what his page on the www.w3c.org splash page, > and there > were indeed elements which appear to be singletons (banner, navBlock) but > used classes > instead of ID. Is there some technical reason for these layout divs to be > marked up > with classes? >
I don't think there's any "should" here. An ID has several uses - for HTML anchors and JavaScript as well as CSS. Using an ID for CSS not only indicates that the element is unique on the page, but adds specificity to any rule using it as part of the selector chain. For this reason, I suggest caution in using very many IDs on a page. I had a small JavaScript job to do earlier this year. The script was an easy adaptation of a YUI calendar, and did not take me long. When it came to adding it to the client's pages, though, I discovered long selector chains in their CSS that included two or more IDs. The work of overcoming so much specificity made the CSS work take longer than the scripting! Fortunately, the client paid for my time. :) Cordially, David -- ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/