This link has been bookmarked by 46 people . It was first bookmarked on 23 Feb 2007, by dean d.
-
30 Oct 15
-
03 Aug 15
-
See the section on inheritance for the definition of computed values when the specified value is 'inherit'.
-
can only be determined when the document is being laid out
-
Cascading order
-
-
02 Apr 14
-
25 Feb 14
-
borders with integer pixel widths
-
approximate
-
only black and white
-
emphasizing
-
and is not intercepted by anonymous boxes.
-
precede
-
overlap
-
is reversed, however, for "!important" rules
-
Precedence
-
user important declarations
-
Declarations in imported style sheets are considered to be before any declarations in the style sheet itself.
-
Declaring a shorthand property (e.g., 'background') to be "!important" is equivalent to declaring all of its sub-properties to be "!important".
-
'style' attribute
-
attributes
-
based only on the form of the selector.
-
presentational attributes
-
equal to 0
-
at the start of the author style sheet
-
with color attributes
-
! important;
-
-
10 Nov 13
-
31 Mar 13
-
24 Feb 13
Natalie Harzic"6 Assigning property values, Cascading, and Inheritance"
-
13 Jun 12
-
10 Mar 12
-
15 Feb 12
-
Once a user agent has parsed a document and constructed a document tree, it must assign, for every element in the tree, a value to every property that applies to the target media type.
-
6.1.1 Specified values
-
User agents must first assign a specified value to each property based on the following mechanisms (in order of precedence):
-
6.1.2 Computed values
-
'em' and 'ex' units are computed to pixel or absolute lengths
-
6.1.3 Used values
-
Computed values are processed as far as possible without formatting the document
-
Some values, however, can only be determined when the document is being laid out.
-
For example, if the width of an element is set to be a certain percentage of its containing block, the width cannot be determined until the width of the containing block has been determined. The used value is the result of taking the computed value and resolving any remaining dependencies into an absolute value.
-
6.1.4 Actual values
-
A used value is in principle the value used for rendering
-
but a user agent may not be able to make use of the value in a given environment. For example, a user agent may only be able to render borders with integer pixel widths and may therefore have to approximate the computed width, or the user agent may be forced to use only black and white shades instead of full color.
-
The actual value is the used value after any approximations have been applied.
-
6.2 Inheritance
-
the 'font-size' property for the H1 element will have the computed value '13pt' (130% times 10pt, the parent's value). Since the computed value of 'font-size' is inherited, the EM element will have the computed value '13pt' as well. If the user agent does not have the 13pt font available, the actual value of 'font-size' for both H1 and EM might be, for example, '12pt'.
-
Note that inheritance follows the document tree and is not intercepted by anonymous boxes.
-
6.2.1 The 'inherit' value
-
If the 'inherit' value is set on the root element, the property is assigned its initial value.
-
In the example below, the 'color' and 'background' properties are set on the BODY element. On all other elements, the 'color' value will be inherited and the background will be
-
transparen
-
The '@import' rule allows users to import style rules from other style sheets. In CSS 2.1, any @import rules must precede all other rules (except the @charset rule, if present). See the section on parsing for when user agents must ignore @import rules
-
The '@import' keyword must be followed by the URI of the style sheet to include. A string is also allowed; it will be interpreted as if it had url(...) around it.
-
The following rules illustrate how @import rules can be made media-dependent:
@import url("fineprint.css") print; @import url("bluish.css") projection, tv; -
In the absence of any media types, the import is unconditional. Specifying 'all' for the medium has the same effect. The import only takes effect if the target medium matches the media list.
-
6.4 The cascade
-
Style sheets may have three different origins: author, user, and user agent.
-
Style sheets from these three origins will overlap in scope, and they interact according to the cascade.
-
By default, rules in author style sheets have more weight than rules in user style sheets. Precedence is reversed, however, for "!important" rules. All user and author rules have more weight than rules in the UA's default style sheet.
-
Pseudo-elements and pseudo-classes are counted as normal elements and classes, respectively.
-
Apart from the "!important" setting on individual declarations, this strategy gives author's style sheets higher weight than those of the reader.
-
By default, rules in an author's style sheet override those in a user's style sheet (see cascade rule 3).
-
However, for balance, an "!important" declaration (the delimiter token "!" and keyword "important" follow the declaration) takes precedence over a normal declaration.
-
Both author and user style sheets may contain "!important" declarations, and user "!important" rules override author "!important" rules.
-
to honor presentational attributes in an HTML source document. If so, these attributes are translated to the corresponding CSS rules with specificity equal to 0, and are treated as if they were inserted at the start of the author style sheet. They may therefore be overridden by subsequent style sheet rules. In a transition phase, this policy will make it easier for stylistic attributes to coexist with style sheets.
-
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; }
-
28 Dec 11
-
inheritance (the "computed value")
-
specification (the "specified value"
-
absolute value
-
local environment (the "actual value")
-
-
24 Aug 11
-
Once a user agent has parsed a document and constructed a document tree, it must assign, for every element in the tree, a value to every property that applies to the target media type.
The final value of a property is the result of a four-step calculation: the value is determined through specification (the "specified value"), then resolved into a value that is used for inheritance (the "computed value"), then converted into an absolute value if necessary (the "used value"), and finally transformed according to the limitations of the local environment (the "actual value").
-
Specified values are resolved to computed values during the cascade; for example URIs are made absolute and 'em' and 'ex' units are computed to pixel or absolute lengths. Computing a value never requires the user agent to render the document.
-
Computed values are processed as far as possible without formatting the document. Some values, however, can only be determined when the document is being laid out. For example, if the width of an element is set to be a certain percentage of its containing block, the width cannot be determined until the width of the containing block has been determined. The used value is the result of taking the computed value and resolving any remaining dependencies into an absolute value.
-
A used value is in principle the value used for rendering, but a user agent may not be able to make use of the value in a given environment. For example, a user agent may only be able to render borders with integer pixel widths and may therefore have to approximate the computed width, or the user agent may be forced to use only black and white shades instead of full color. The actual value is the used value after any approximations have been applied.
-
6.2 Inheritance
-
color: inherit !important;
-
The following rules illustrate how @import rules can be made media-dependent:
@import url("fineprint.css") print; @import url("bluish.css") projection, tv; -
By default, rules in author style sheets have more weight than rules in user style sheets. Precedence is reversed, however, for "!important" rules.
-
-
30 Apr 11
Frank Anthony6.3 The @import rule
The following lines are equivalent in meaning and illustrate both '@import' syntaxes (one with "url()" and one with a bare string):
@import "mystyle.css";@import url("mystyle.css"); -
27 Apr 11
-
25 Feb 11
Dan Shumakerree different origins: author, user, and user agent
-
and 'em' and 'ex' units are computed to pixel or absolute lengths
-
for example URIs are made absolute
-
percentage
-
The used value is the result of taking the computed value and resolving any remaining dependencies into an absolute value.
-
may be forced to use only black and white shades instead of full color
-
elements inherit computed values
-
the one with the greatest weight takes precedence.
-
The CSS cascade assigns a weight to each style rule.
-
importance (normal or important) and origin
-
more specific selectors will override more general ones
-
the latter specified wins.
-
number of ID
-
classes
-
number of element names
-
large base) gives the specificity.
-
Concatenating the four numbers a-b-c-d
-
-
24 May 10
-
13 Sep 09
-
10 Sep 09
-
29 Jul 09
-
29 May 09
-
18 Feb 09
-
05 Feb 09
-
26 Feb 08
-
23 Feb 07
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.