CSS 2.1 (W3C Working Draft) 6.4
!Important; and the Precedence of non-CSS presentational hints

the following is an excerpt from the Cascading Style Sheets, level 2 revision 1 CSS 2.1 Specification which appears in the Panelizer, a convenient package of resources, available FREE in a .zip archive, and downloadable via Rijk‘s handy link (Rijk is a well known, and credible People.Opera.com user and author).This is not the complete text from the original resource, or from Rijk’s Panelizer, but merely a sample snippet which i’ve cut to jar my memory of the original text. Follow the URL here, in the previous sentence for the complete, original document.


6.4.2 !important rules: an excerpt

Declaring a shorthand property (e.g., ‘background’) to be “!important” is equivalent to declaring all of its sub-properties to be “!important”.The first rule in the user’s style sheet in the following example contains an “!important” declaration, which overrides the corresponding declaration in the author’s style sheet. The second declaration will also win due to being marked “!important”. However, the third rule in the user’s style sheet is not “!important” and will therefore lose to the second rule in the author’s style sheet (which happens to set style on a shorthand property). Also, the third author rule will lose to the second author rule since the second rule is “!important”. This shows that “!important” declarations have a function also within author style sheets./* From the user’s style sheet */
p { text-indent: 1em ! important }
p { font-style: italic ! important }
p { font-size: 18pt }/* From the author’s style sheet */
p { text-indent: 1.5em !important }
p { font: normal 12pt sans-serif !important }
p { font-size: 24pt }

6.4.4 Precedence of non-CSS presentational hints: an excerpt

The following user stylesheet 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; }


http://people.opera.com/rijk/panels/panelizer.html
(or http://people.opera.com/rijk/panels/ )
Rijk van Geijtenbeek. © Rijk 2005
(note: Rijk’s current: http://www.xs4all.nl/~vangeijt/ )
VI: Assigning property values, Cascading, and Inheritance
Cascading Style Sheets, level 2 revision 1
CSS 2.1 Specification
W3C Working Draft 13 June 2005
Copyright © 2005 W3C ® (MIT, ERCIM, Keio), All Rights Reserved.

Whatchu do


Leave a Reply

Your email address will not be published. Required fields are marked *