On 09/07/2004, at 5:55 PM, Mordechai Peller wrote:
Putting an id or class on the html or body tags is a useful way of targeting slight variations in style rules with resorting to a second style sheet.
I remember seeing a discussion of the pros and cons, but I can't remember where. Does anybody have a link? Or perhaps the discussion can begin anew.
I use id and class attributes on the body all the time. I don't really like using them for something like <body id='3-col-red'> because that's a presentational thing (IMHO), but I do use it for something like <body id='home'>, in which case I can target elements on #home separately to those on #about or #forum, which allows drastically different styling for each page.
For me, it's a way of keeping my ids and classes as generic and minimal as possible, but still only using one stylesheet.
The alternative (for my uses) is to have many stylesheets for each section, but this is an absolute pain, unless there are heaps of styles, in which case smaller stylesheets on deman seems much smarter.
I know others use them to:
- identify the domain (so others can easily override the stylesheets with a single user style sheet), but I *really* question how many people would bother to do this. eg <body id='www-meyerweb-com'> see http://www.meyerweb.com/
- trigger different layouts eg <body id='col-SMX'> see http://www.adaptivepath.com/
- trigger active and inactive tabs on a menu navigation (can't think of an example)
Hope this gives you an idea or two :)
--- Justin French http://indent.com.au
*****************************************************
The discussion list for http://webstandardsgroup.org/
See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
*****************************************************