22.12.2013 Views

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

W3C CSS2 Cascading Style Sheets, level 2 - instructional media + ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Example(s):<br />

The following rules have the same effect as if the imported style sheet were<br />

wrapped in an @<strong>media</strong> rule for the same <strong>media</strong>, but it may save the UA a fruitless<br />

download.<br />

@import url("fineprint.css") print;<br />

@import url("bluish.css") projection, tv;<br />

In the absence of any <strong>media</strong> types, the import is unconditional. Specifying ’all’<br />

for the medium has the same effect.<br />

6.4 The cascade<br />

<strong>Style</strong> sheets may have three different origins: author, user, and user agent.<br />

Author. The author specifies style sheets for a source document according<br />

to the conventions of the document language. For instance, in HTML, style<br />

sheets may be included in the document or linked externally.<br />

User: The user may be able to specify style information for a particular document.<br />

For example, the user may specify a file that contains a style sheet or<br />

the user agent may provide an interface that generates a user style sheet (or<br />

behave as if it did).<br />

User agent: Conforming user agents [p. 32] must apply a default style sheet<br />

(or behave as if they did) prior to all other style sheets for a document. A<br />

user agent’s default style sheet should present the elements of the document<br />

language in ways that satisfy general presentation expectations for the<br />

document language (e.g., for visual browsers, the EM element in HTML is<br />

presented using an italic font). See "A sample style sheet for HTML 4.0"<br />

[p. 291] for a recommended default style sheet for HTML 4.0 documents.<br />

Note that the default style sheet may change if system settings are modified<br />

by the user (e.g., system colors). However, due to limitations in a user<br />

agent’s internal implementation, it may be impossible to change the values<br />

in the default style sheet.<br />

<strong>Style</strong> sheets from these three origins will overlap in scope, and they interact<br />

according to the cascade.<br />

The CSS cascade assigns a weight to each style rule. When several rules<br />

apply, the one with the greatest weight takes precedence.<br />

By default, rules in author style sheets have more weight than rules in user<br />

style sheets. Precedence is reversed, however, for "!important" rules. All rules<br />

user and author rules have more weight than rules in the UA’s default style<br />

sheet.<br />

Imported style sheets also cascade and their weight depends on their import<br />

order. Rules specified in a given style sheet override rules imported from other<br />

style sheets. Imported style sheets can themselves import and override other<br />

style sheets, recursively, and the same precedence rules apply.<br />

72

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!