Re: [CSS21] Status of defult (intrinsic) style sheet in UA

Boris Zbarsky wrote:
> Lachlan Hunt wrote:
>> We see that in first position is the user agent's stylesheets 
>> (including normal and !important rules), and positions 2 to 5 are the 
>> user and author stylesheets.  Perhaps that could be clarified as:
>>    1. *user agent normal style sheets*
>>    2. *user agent important style sheets*
> What does it mean for a user agent style sheet to be important?  How do 
> you tell?  Keep in mind that there may be no actual CSS style sheet there.

I didn't notice that in 6.4.2, it defines that only user and author 
stylesheets can contain !important rules, and incorrectly assumed that 
they could be used in a UA stylesheet as well.  However, it doesn't seem 
to be defined how a UA should handle such rules in a UA stylesheet. 
Should they be ignored?  Should they be treated as normal rules?  Should 
they do as I suggested above and only override other user agent normal 
styles? Or something else, like what Firefox does?

To test this, I tried the following rules in Firefox:

/* html.css (UA stylesheet) */

h1 { color: red !important; }
h1 { color: blue; }

/* userContent.css */

h1 { color: green !important; }

/* Author stylesheet */
h1 { color: silver !important; }

I then restarted Firefox and was given red headings.  So, clearly 
Mozilla is treating UA !important rules above all others, including user 
!important stylesheets.  While it is unlikely that a vendor would put 
!important rules in their stylesheet by default, the result should be 
well defined in such cases.

Lachlan Hunt

Received on Wednesday, 23 November 2005 02:11:22 UTC