Style sheet origin
At the top level, user agents look at the origin of the style declarations. Browsers give different weight to style sheets from the following sources, listed from the least weight to greatest:
- User agent style sheets
This is the style information that is built into the browsing device for rendering HTML elements and sets their default appearance.
- Reader style sheets
The reader (or user) may also create a style sheet. Reader style sheets override the default browser styles.
- Author style sheets
When the author of a document attaches a style sheet to it, those declarations take precedence over the reader and user agent style sheets (with an “important” exception, listed next).
In CSS 2, reader style declarations marked as
!important(see the sidebar "Assigning Importance“) trump all style declarations, even those from author style sheets.
In CSS 1, any style marked as “important” by the author took precedence over all reader styles. This was reversed in CSS 2.
After considering the source of the style sheet, there is another hierarchy of weights applied to style sheets created by the document’s author. As discussed in this chapter, authors may attach style information to documents as inline styles, an embedded style element, or one or more external style sheets. These points of origin within the author style sheets are given varying weights as well (remember, all author styles override reader and user agent styles unless the ...