RE: !important

Ian Jacobs pointed this thread out to me and suggested that I might have 
something useful to say.


Regarding whether CSS1 !important (author wins) is implemented or CSS2
!important (user wins) is implemented, in IE5/Mac, we implemented the CSS2
version (user style sheet wins).


From: Joel Sanda <joels@ecollege.com>
Date: Tue, 17 Jul 2001 11:39:48 -0600
Subject: RE: !important

> Using the same file for the Opera example
> (http://www.geocities.com/joelsanda/important.htm)

I loaded this example, saw two paragraphs of large red text, and what
appeared to be a third paragraph of plain/normal text.

Then I downloaded the user style sheet Wendy posted:

 http://lists.w3.org/Archives/Public/w3c-wai-ua/2001JulSep/att-0122/01-user-
important.css

and saved it to my desktop, and configured IE5/Mac (through its preferences)
to use the user style sheet 01-user-important.css on my desktop.

The document important.htm was automatically reloaded with the new user
style sheet, which resulted in two paragraphs of normal sized white text on
a grey background, and what again appeared to be a third paragraph of
plain/normal text.

Since it seemed wrong that the user styles were not applied to the third
"paragraph", I took a look at the source, which had:

 <p.you>This sentence should change when you specify user font
attributes.</p>

"p.you" is not a valid HTML tag, and therefore should be ignored by
conforming HTML implementations, which places the text which follows into
the <body> element, and not inside any paragraph, hence it is not styled by
the user rule.

I think what was intended was:

 <p class='you'>This sentence should change when you specify user font
attributes.</p>

Which works as expected (user style is applied).

> Netscape 4.77 for Windows
> preserved the !important declaration for the paragraph tag but also allowed
> me to override the paragraph tag that did not have !important.

This is incorrect since the third "paragraph" is not a paragraph and should
not have any of the style rules in the user or author style sheets applied
to it.

> Opera 5.12 (Windows) will not override the normal p class

Same result as IE5/Mac - this is correct.

Tantek

Received on Saturday, 21 July 2001 22:10:20 UTC