Peter-Paul Koch wrote:
>Consider this situation:
>
>div#test {
> text-decoration: none !important:
>}
>
><div id="test" style="text-decoration: underline">
>Test DIV
></div>
>
>Mozilla, Explorer Mac and Opera obey the underline, Explorer Win and
>Safari the none.
>
>Who's right? Why?
Explorer Win and Safari are correct, in my view, but the issue is not
clear-cut. The 2.1 spec <http://www.w3.org/TR/CSS21/> says in
section 6.4.1 that UA's should sort styles in the following order:
1. Media type and element match
2. Importance and origin in ascending order of importance (confusingly):
A. user agent style sheets
B. user normal style sheets
C. author normal style sheets
D. author important style sheets
E. user important style sheets
3. Specificity
4. Source order
In section 6.4.3, specificity for inline style attributes is
explicitly defined, and although they are given maximal importance,
the sort order for specificity as a whole comes after importance and
origin. Accordingly, I would say that !important declarations of any
specificity should outweigh style attributes. Moreover, this is a
desirable outcome, since it would give user !important style
declarations absolute priority over style attributes.
The spec could be more clearly worded, however. (Note, e.g., that
style attributes are never explicitly mentioned, nor is it absolutely
explicit that "sort order" means "order in which declarations are to
be applied".) Further, the 2.0 version of the spec
<http://www.w3.org/TR/REC-CSS2/cascade.html> (which is technically
still the active Rec) is considerably more ambiguous. So, there is
probably some room for disagreement. Nevertheless, I think this
interpretation is the most defensible one from the text, and probably
the most desirable in actual practice.
Is that clear as mud?
-Adam Kuehn
Durham, NC
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/