W3C home > Mailing lists > Public > www-html@w3.org > July 2005

Why the Class Attribute in External Style Sheets Isn't Preferred

From: Lonnie Best <w3@startport.com>
Date: Thu, 7 Jul 2005 11:49:04 -0500
To: <www-html@w3.org>
Message-ID: <BIGJOHNninarBU393Ih000002bf@mail.theviperpit.net>
> is there any particular part about this that cannot be solved by the use
of a class attribute?

 
Yes, as you mentioned, you can narrow the influence of styling in an
external stylesheet by using the id or class attributes.
 
However, when you are programmatically building a dynamic web site "one
*varyingly styled* div tag at time", it becomes increasingly difficult to
ensure the uniqueness of each class name or id name you give to these
elements that are intended to be varyingly styled. It is very difficult to
programmatically ensure that one Global External Style sheet will properly
style a vast number of programmatically generated markup elements.
 
These potential naming conflicts can be avoid with inline CSS styling, but
with inline styling
1.    Much Redundancy ends up in the markup.
2.    Browsers don't cache inline style, it is downloaded each page load.
 
I'm currently testing the @import method (indicated by Jens Meiert).
 
Received on Thursday, 7 July 2005 16:49:20 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:03 GMT