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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6 Assigning property values, <strong>Cascading</strong>,<br />

and Inheritance<br />

Contents<br />

6.1 Specified, computed, and actual values . . . . . . . 69 .<br />

6.1.1 Specified values . . . . . . . . . . . 69 .<br />

6.1.2 Computed values . . . . . . . . . . . 70 .<br />

6.1.3 Actual values . . . . . . . . . . . . 70 .<br />

6.2 Inheritance . . . . . . . . . . . . . . 70 .<br />

6.2.1 The ’inherit’ value . . . . . . . . . . . 71 .<br />

6.3 The @import rule . . . . . . . . . . . . 71 .<br />

6.4 The cascade . . . . . . . . . . . . . . 72 .<br />

6.4.1 <strong>Cascading</strong> order . . . . . . . . . . . 73 .<br />

6.4.2 !important rules . . . . . . . . . . . 73 .<br />

6.4.3 Calculating a selector’s specificity . . . . . . . 74 .<br />

6.4.4 Precedence of non-CSS presentational hints . . . . 74 .<br />

6.1 Specified, computed, and actual values<br />

Once a user agent has parsed a document and constructed a document tree<br />

[p. 30] , it must assign, for every element in the tree, a value to every property<br />

that applies to the target <strong>media</strong> type [p. 77] .<br />

The final value of a property is the result of a three-step calculation: the value<br />

is determined through specification (the "specified value"), then resolved into an<br />

absolute value if necessary (the "computed value"), and finally transformed<br />

according to the limitations of the local environment (the "actual value").<br />

6.1.1 Specified values<br />

User agents must first assign a specified value to a property based on the following<br />

mechanisms (in order of precedence):<br />

1. If the cascade [p. 72] results in a value, use it.<br />

2. Otherwise, if the property is inherited [p. 70] , use the value of the parent<br />

element, generally the computed value.<br />

3. Otherwise use the property’s initial value. The initial value of each property is<br />

indicated in the property’s definition.<br />

Since it has no parent, the root of the document tree [p. 30] cannot use values<br />

from the parent element; in this case, the initial value is used if necessary.<br />

69

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

Saved successfully!

Ooh no, something went wrong!