The role of the style attribute: HTML WG official position

There has been a lot of shouting in this group about the style attribute, so
I want to pour some oil on the waters.

First, a rumour that needs dispelling is that the HTML WG is somehow anti
CSS or anti stylesheets. Not at all true. We are fans of styling, and think
it is the correct approach. My own qualifications: you will find my name in
both the CSS1 Rec and the CSS2 Rec. I chaired the first W3C styling activity
and was member of the CSS WG for a long time. I am giving a CSS tutorial at
the CHI conference this year.

Now the style attribute. I have tried to reconstruct the reasoning we used
for dropping the style attribute from HTML:

1) Styling is not part of XHTML 1.1; it is intended to be a document
structuring language; it is just an XML application. So it is wrong to put a
style attribute in the HTML namespace (which is not to say that it shouldn't
be somewhere else; see below).

2) The reason for introducing style sheets is the separation of document and
styling; adding it back as an attribute destroys that separation.

3) If there is a need for a style attribute, it is needed in all XML, not
just XHTML; if you need element-wise styling, you will want it on the MathML
elements in your document as well, and so should be in an XML or Style
namespace;

4) This is the big one: the current style attribute is not language
independent (you can't have one style attribute for CSS, one for XSL, etc).
This means that you bind the document to one styling language, which is
antithetical to the whole idea behind style sheets.

5) ISO-HTML also dropped the style attribute.

So the best way forward for the Web, should the community feel there is a
need for mixing document structure with styling, would be to have a
namespace for each styling language. Then you could say

    <p css:style="..." xsl:style="...">

and the user agent can choose which it wants to use.

Styling is not in the purview of the HTML WG, and it would not be up to the
HTML WG to define those namespaces.

Steven Pemberton
Chair, HTML WG

Received on Tuesday, 29 February 2000 06:51:21 UTC