[CSS21] Making sense of 6.4.4

I'm having trouble making sense of 6.4.4 Precedence of non-CSS
presentational hints[1] which concerns the use of attributes such as 
color, border and size in HTML documents.  It says:

   # The UA may choose to honor presentational attributes in an HTML
   # source document. If so, these attributes are translated to the
   # corresponding CSS rules with specificity equal to 0, and are treated
   # as if they were inserted at the start of the author style sheet.
   # They may therefore be overridden by subsequent style sheet rules.
   #
   # [...]
   #
   # The following user style sheet would override the font weight of 'b'
   # elements in all documents, and the color of 'font' elements with
   # color attributes in XML documents. It would not affect the color of
   # any 'font' elements with color attributes in HTML documents:
   #
   #   b { font-weight: normal; }
   #   font[color] { color: orange; }
   #
   # The following, however, would override the color of font elements in
   # all documents:
   #
   #   font[color] { color: orange ! important; }

The title of the section and the example at the end indicate that the 
idea is that presentation attributes in the HTML should be powerful and 
thus hard to override via CSS.  However, the wording of the first 
paragraph quoted above seems to suggest the opposite, that they easy to 
override.

In particular, I interpret that paragraph as saying that for the HTML 
markup fragment

   <font color="green">lorem ipsum</font>

the author style sheet is treated as having the rule set

   font[color] { color: attr(color); }

at its start, and that the selector in that rule set has specificity 0. 
  This would mean that a later specified rule set

   font[color] { color: orange; }

would win out, being later in the cascade and trivially having equal or 
greater specificity (in fact, it has specificity 11=(0,0,1,1)).

But that's not what the example says, so I'm getting something wrong 
somewhere.

[1] http://www.w3.org/TR/CSS21/cascade.html#preshint


Cheers,
Anton Prowse
http://dev.moonhenge.net

Received on Friday, 13 March 2009 22:53:00 UTC