8000 csswg-drafts/css-cascade/Overview.src.html at 78f62a3b4d5eb01e60c6dfc9e19127a1c86ad93a · w3c/csswg-drafts · GitHub
Skip to content

Latest commit

 

History

History
900 lines (739 loc) · 32.4 KB

File metadata and controls

900 lines (739 loc) · 32.4 KB
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<meta charset=utf8>
<title>CSS Cascading and Inheritance Level 3</title>
<link href="../default.css" rel="stylesheet" type="text/css">
<link href="../csslogo.ico" rel="shortcut icon" type="image/x-icon">
<link href="http://www.w3.org/StyleSheets/TR/W3C-[STATUS].css" rel=stylesheet type="text/css">
</head>
<div class="head">
<!--logo-->
<h1>CSS Cascading and Inheritance Level 3</h1>
<h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2>
<dl>
<!--
<dt>This version:
<dd><a href="[VERSION]">http://www.w3.org/TR/[YEAR]/WD-css3-cascade-[CDATE]/</a>
-->
<dt>Latest version:
<dd><a href="http://www.w3.org/TR/css3-cascade/">http://www.w3.org/TR/css3-cascade/</a>
<dt>Editor's draft:
<dd><a href="http://dev.w3.org/csswg/[SHORTNAME]/">http://dev.w3.org/csswg/[SHORTNAME]/</a>
<dt>Previous version:
<dd><a href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215/">http://www.w3.org/TR/2005/WD-css3-cascade-20051215/</a>
<dt>Feedback:</dt>
<dd><a href="mailto:www-style@w3.org?subject=%5Bcss-cascade%5D%20feedback"
>www-style@w3.org</a>
with subject line &ldquo;<kbd>[css-cascade]
<var>&hellip; message topic &hellip;</var></kbd>&rdquo;
(<a rel="discussion" href="http://lists.w3.org/Archives/Public/www-style/"
>archives</a>)
<dt>Editors:
<dd class='vcard'>
<a class='email fn' href="mailto:howcome@opera.com">Håkon Wium Lie</a> (<span class='org'>Opera Software</span>)
<dd class='vcard'>
<a class='url fn' href="http://fantasai.inkedblade.net/contact">Elika J. Etemad</a> (<span class='org'>Mozilla</span>)
<dd class='vcard'>
<a class='url fn' href="http://www.xanthir.com/contact/">Tab Atkins Jr.</a> (<span class='org'>Google</span>)
</dl>
<!--copyright-->
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc">Abstract</h2>
<p>
This CSS module describes how to collate style rules
and assign values to all properties on all elements.
By way of cascading and inheritance,
values are propagated for all properties on all elements.
<a href="http://www.w3.org/TR/CSS/">CSS</a> is a language
for describing the rendering of structured documents (such as HTML and XML)
on screen, on paper, in speech, etc.
<h2 class="no-num no-toc">
Status of this document</h2>
<!--status-->
<h2 class="no-num no-toc">
Table of contents</h2>
<!--toc-->
<hr>
<h2>Introduction</h2>
<p>
One of the fundamental design principles of CSS is <em>cascading</em>,
which allows several style sheets to influence the presentation of a document.
When different declarations try to set a value for the same element/property combination,
the conflicts must somehow be resolved.
<p>
The opposite problem arises when no declarations try to set a the value for an element/property combination.
In this case, a value must be found by way of <em>inheritance</em>
or by looking at the property's <em>initial value</em>.
<p>
The rules for finding the specified value for all properties on all elements in the document are described in this specification.
The rules for finding the specified values in the page context and its margin boxes are described in [[CSS3PAGE]].
<h2 id="at-import">
Importing style sheets: the ''@import'' rule</h2>
<p>
The <dfn>''@import''</dfn> rule allows users to import style rules from other style sheets.
Any ''@import'' rules must precede all other at-rules and style rules in a stylesheet
(besides ''@charset'', which must be the first thing in the stylesheet if it exists),
or else the ''@import'' rule is invalid.
The syntax of ''@import'' is:
<pre class='prod'><dfn>&lt;import-rule></dfn> = @import [ &lt;url> | &lt;string> ] &lt;media-query-list>? ;<pre>
<p>
If a <var>&lt;string></var> is provided,
it must be interpreted as a url with the same value.
<div class="example">
<p>
The following lines are equivalent in meaning
and illustrate both '@import' syntaxes
(one with ''url()'' and one with a bare string):
<pre><!--
-->@import "mystyle.css";&#xa;<!--
-->@import url("mystyle.css");</pre>
</div>
<p>
So that user agents can avoid retrieving resources for unsupported media types,
authors may specify media-dependent ''@import'' rules.
Such media-dependent imports include a comma-separated list of “media queries” after the URI.
In the absence of any media query, the import is unconditional.
(Specifying ''all'' for the medium has the same effect.)
The UA must import the style sheet if (and only if) the media condition evaluates to true.
<div class=example>
<p>
The following rules illustrate how ''@import'' rules can be made media-dependent:
<pre><!--
-->@import url("fineprint.css") print;&#xa;<!--
-->@import url("bluish.css") projection, tv;&#xa;<!--
-->@import url("narrow.css") handheld and (max-width: 400px);</pre>
</div>
<p>
The evaluation and full syntax of the expressions after the URL
is defined by the Media Queries specification [[!MEDIAQ]].
<p>
When the same style sheet is imported or linked to a document in multiple places,
user agents must process (or act as though they do) each link
as though the link were to a separate style sheet.
<p>
The <i>origin</i> of an imported stylesheet is the same as the <i>origin</i> of the stylesheet that imported it.
<h3 id='import-content-type'>
Content-Type of imported stylesheets</h3>
<p>
The processing of imported stylesheets depends on the actual type of the linked resource.
If the resource does not have <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/fetching-resources.html#content-type">Content-Type metadata</a>,
or the host document is in <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#quirks-mode">quirks mode</a>
and has the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/origin-0.html#same-origin">same origin</a> as the imported stylesheet,
the type of the linked resource is <code>text/css</code>.
Otherwise, the type is determined from its <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/fetching-resources.html#content-type">Content-Type metadata</a>.
<p>
If the linked resource's type is <code>text/css</code>,
it must be interpreted as a CSS stylesheet.
Otherwise, it must be interpreted as a network error.
<h2 id='shorthand'>
Shorthand Properties</h2>
<p>
Some properties are <dfn>shorthand properties</dfn>,
meaning that they allow authors to specify the values of several properties with a single property.
A shorthand property sets all of its longhand sub-properties,
exactly as if expanded in place.
<div class='example'>
<p>
For example, the CSS 2.1 'font' property
is a shorthand property for setting 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height', and 'font-family' all at once.
The multiple declarations of this example:
<pre>
h1 {
font-weight: bold;
font-size: 12pt;
line-height: 14pt;
font-family: Helvetica;
font-variant: normal;
font-style: normal;
}</pre>
<p>can therefore be rewritten as
<pre>h1 { font: bold 12pt/14pt Helvetica }</pre>
</div>
<p>
When values are omitted from a shorthand form,
unless otherwise defined,
each "missing" sub-property is assigned its <i>initial value</i>.
<p class='note'>
This means that a shorthand property declaration always sets <em title=''>all</em> of its subproperties,
even those that are not explicitly set.
Carelessly used, this might result in inadvertently resetting some sub-properties.
Carefully used, a shorthand can guarantee a "blank slate"
by resetting sub-properties inadvertently cascaded from other sources.
For example, writing ''background: green'' rather than ''background-color: green''
ensures that the background color overrides any earlier declarations
that might have set the background to an image.
<p>
In some cases, a shorthand might have different syntax
or special keywords
that don't directly correspond to values of its sub-properties.
(In such cases, the shorthand will explicitly define the expansion of its values.)
<p>
If a shorthand is specified as one of the <a href="http://www.w3.org/TR/css3-values/#common-keywords">CSS-wide keywords</a>,
it sets all of its sub-properties to that keyword.
(Note that these keywords cannot be combined with other values in a single declaration, not even in a shorthand.)
<p>
Declaring a shorthand property to be ''!important''
is equivalent to declaring all of its sub-properties to be ''!important''.
<h3 id="all-shorthand">
Resetting All Properties: the ''all'' property</h3>
<table class="propdef">
<tr>
<th>Name:
<td><dfn>all</dfn>
<tr>
<th>Value:
<td>initial | inherit | default
<tr>
<th>Initial:
<td>See individual properties
<tr>
<th>Applies to:
<td>See individual properties
<tr>
<th>Inherited:
<td>See individual properties
<tr>
<th>Percentages:
<td>See individual properties
<tr>
<th>Media:
<td>See individual properties
<tr>
<th>Computed value:
<td>See individual properties
<tr>
<th>Animatable:
<td>See individual properties
</table>
<p>
The ''all'' property is a shorthand that resets <em title=''>all</em> CSS properties.
It only accepts the <a href="http://www.w3.org/TR/css3-values/#common-keywords">CSS-wide keywords</a>.
<div class='example'>
<p>
For example, if an author specifies ''all: default'' on an element
it will block all inheritance and reset all properties,
as if no rules appeared in the author level of the cascade.
<p>
This can be useful for the root element of a "widget" included in a page,
which does not wish to inherit the styles of the outer page.
</div>
<h2 id="cascade-and-inheritance">
Cascading and Inheritance</h2>
<p>
The cascading and inheritance process
takes a set of declarations as input,
and outputs a specified value for each property on each element.
<h3 id='filter-declarations'>
Filtering Declarations</h3>
<p>
In order to find the specified values,
implementations must first identify all declarations that apply to each element.
A declaration applies to an element if:
<ul>
<li>
It belongs to a stylesheet that currently applies to this document.
<li>
It is not qualified by a conditional rule [[!CSS3-CONDITIONAL]] with a false condition.
<li>
It belongs to a style rule whose selector matches the element. [[!SELECT]]
(Taking <a href="http://www.w3.org/TR/selectors4/#scoping">scoping</a> into account, if necessary.)
</ul>
<p>
The declarations that apply form,
for each property on each element,
a list of potential values.
The next section,
the cascade,
prioritizes these lists.
<h3 id='cascade'>
Cascading Declarations</h3>
<p>
The cascade algorithm takes an unordered list of declarations
for a given property on an element
and sorts it by precedence as determined below.
<p>
User agents must sort declarations according to the following criteria,
in descending order of priority:
<dl>
<dt id='cascade-origin'>Origin
<dd>
The <i>origin</i> of a declaration is based on where it comes from
and whether or not it is declared ''!important'' (see below).
The precedence of the various <i>origins</i> is, in descending order:
<ol>
<li>Transition declarations [[!CSS3-TRANSITIONS]] <sup><a href="#animations-origin-note">[NOTE]</a></sup>
<li>Important user agent declarations
<li>Important user declarations
<li>Important override declarations [[!DOM-LEVEL-2-STYLE]]
<li>Important author declarations
<li>Animation declarations [[!CSS3-ANIMATIONS]] <sup><a href="#animations-origin-note">[NOTE]</a></sup>
<li>Normal override declarations [[!DOM-LEVEL-2-STYLE]]
<li>Normal author declarations
<li>Normal user declarations
<li>Normal user agent declarations
</ol>
<p id="animations-origin-note" class="note">
The precise ordering of Transition and Animation declarations is still under <a href="http://lists.w3.org/Archives/Public/www-style/2013Mar/0297.html">discussion</a>.
<p>
Declarations from <i>origins</i> earlier in this list win over declarations from later <i>origins</i>.
<dt id='cascade-scope'>Scope
<dd>
A declaration can be <dfn>scoped</dfn> to a subtree of the document
so that it only affects its <dfn>scoping element</dfn> and that element's descendants.
For example, [[HTML5]] defines scoped <code>&lt;style&gt;</code> elements,
whose style sheets are scoped to the element's parent.
<p>
If the <i>scoping elements</i> of two declarations
have an ancestor/descendant relationship,
then for normal rules the declaration whose <i>scoping element</i> is the descendant wins,
and for important rules the declaration whose <i>scoping element</i> is the ancestor wins.
In other words, for normal declarations the inner scope's declarations override,
but for <code>!important</code> rules <em>outer</em> scope's override.
<p>
For the purpose of this step,
all unscoped declarations are considered to be <i>scoped</i> to the root element.
Normal declarations from style attributes
are considered to be <i>scoped</i> to the element with the attribute,
whereas important declarations from style attributes
are considered to be <i>scoped</i> to the root element.
[[!CSSSTYLEATTR]]
<p class="note">
This odd handling of <code>!important</code> style attribute declarations
is to match the behavior defined in CSS Levels 1 and 2,
where style attributes simply have higher specificity than any other author rules. [[CSS21]]
<dt id='cascade-specificity'>Specificity
<dd>
The <a href="http://www.w3.org/TR/selectors/#specificity">Selectors module</a> [[!SELECT]] describes how to compute the specificity of a selector.
For the purpose of this step,
a style rule without a selector
(such as the <a href="http://www.w3.org/TR/css-style-attr/#interpret">contents of a style attribute</a>)
is considered to have a specificity higher than any selector.
The declaration belonging to a style rule whose selector has the highest specificity wins.
<dt id='cascade-order'>Order of appearance.
<dd>
Rules from <i title="@import">imported style sheets</i> are treated as if their stylesheets were substituted in place of the ''@import'' rule.
Stylesheets independently linked by the originating document are treated as if they were concatenated in linking order,
as determined by the host document language.
Style attributes are treated as if their style rules were concatenated in document order, after any stylesheets.
The last declaration wins.
</dl>
<p>
The <dfn>output of the cascade</dfn>
is a (potentially empty) sorted list of declarations for each property on each element.
<h4 id='cascading-origins'>
Cascading Origins</h4>
<p>
Each style rule has an <dfn>origin</dfn>,
which determines where it enters the cascade.
CSS defines three core <i>origins</i>:
<dl>
<dt id='cascade-origin-author'>Author
<dd>
The author specifies style sheets for a source document according to the conventions of the document language. For instance, in HTML, style sheets may be included in the document or linked externally.
<dt id='cascade-origin-user'>User
<dd>
The user may be able to specify style information for a particular document.
For example, the user may specify a file that contains a style sheet
or the user agent may provide an interface that generates a user style sheet
(or behaves as if it did).
<dt id='cascade-origin-ua'>User agent
<dd>
Conforming user agents must apply a default style sheet
(or behave as if they did).
A user agent's default style sheet should present the elements of the document language in ways that satisfy general presentation expectations for the document language
(e.g., for visual browsers, the EM element in HTML is presented using an italic font).
See e.g. the <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#the-css-user-agent-style-sheet-and-presentational-hints">HTML user agent style sheet</a>.
</dl>
<p>
Extensions to CSS define the following additional <i>origins</i>:
<dl>
<dt id='cascade-origin-override'>Override
<dd>
<a>DOM Level 2 Style</a> [[!DOM-LEVEL-2-STYLE]] defines an interface for "override" styles,
which enter the cascade at a higher level than other author rules.
<dt id='cascade-origin-animation'>Animation
<dd>
CSS Animations [[CSS3-ANIMATIONS]] generate "virtual" rules representing their effects when running.
<dt id='cascade-origin-transition'>Transition
<dd>
Like CSS Animations, CSS Transitions [[CSS3-TRANSITIONS]] generate "virtual" rules representing their effects when running.
</dl>
<p>
In addition,
several <i>origins</i> have twin <i>origins</i> defined the same way,
but which contain the ''!important'' rules.
<p>
The normative list of CSS <i>origins</i> is defined in <a href="#cascade-origin">a previous section</a>.
<h4 id='important-rules'>
''!important'' rules</h4>
<p>
CSS attempts to create a balance of power between author and user style sheets.
By default, rules in an author's style sheet override those in a user's style sheet.
To balance this, a declaration can be made <dfn>''!important''</dfn>
<p>
An ''!important'' declaration takes precedence over a normal declaration.
Author and user style sheets may contain ''!important'' declarations,
with user ''!important'' rules overriding author ''!important'' rules.
This CSS feature improves accessibility of documents by giving users with special requirements
(large fonts, color combinations, etc.)
control over presentation.
<p>
A declaration is ''!important'' if the last two (non-whitespace, non-comment) tokens
in its value are the delimiter token ''!'' followed by the identifier token ''important''.
Declaring a shorthand property (e.g., 'background') to be ''!important'' is equivalent to
declaring all of its sub-properties to be ''!important''.
<p>
User agent stylesheets may also contain ''!important'' rules.
These override all author and user rules.
<div class='example'>
<p>
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.
<pre>
/* 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 }</pre>
</div>
<h4 id="preshint">
Precedence of Non-CSS Presentational Hints</h4>
<p>
The UA may choose to honor presentational hints in a source document's markup,
for example the <code>bgcolor</code> attribute or <code>&lt;s></code> element in [[HTML]].
All document language-based styling must be translated to corresponding CSS rules
and either enter the cascade at the user agent level or
be treated as author level rules with a specificity of zero placed at the start of the author style sheet.
A document language may define whether a presentational hint enters at the UA or author level of the cascade;
if so, the UA must behave accordingly.
For example, [[SVG11]] maps its presentation attributes into the author level.
<p class="note">
Presentational hints entering the cascade at the UA level can be overridden by user styles.
Presentational hints entering the cascade at the author level can be overridden by the author's use of the ''default'' keyword.
Host languages should choose the appropriate level for presentational hints with these considerations in mind.
<h4 id="cascaded-value">
The Cascaded Value</h4>
<p>
The <dfn>cascaded value</dfn> represents the result of the cascade.
It is the value of the first declaration in the <i>output of the cascade</i>
(after any rollback steps have been performed, see below).
If the <i>output of the cascade</i> is an empty list,
there is no cascaded value.
<h3 id="defaulting">
Inheritance and Defaulting</h3>
<p>
In most cases, the <i>specified value</i> is the <i>cascaded value</i>.
However, the ''initial'', ''inherit'', and ''default'' values
are handled specially when they are the <i>cascaded value</i> of a property.
<h4 id="initial">
Initial value: the ''initial'' keyword</h4>
<p>
Each property has an <dfn>initial value</dfn>,
defined in the property's definition table.
If the <i>cascaded value</i> is the <dfn id="initial-keyword">''initial''</dfn> keyword,
the property's <i>initial value</i> becomes its <i>specified value</i>.
<h4 id="inheritance">
Inheritance: the ''inherit'' keyword</h4>
<p>
Some properties are <dfn title="inherited property|inherited properties">inherited properties</dfn>,
as defined in their property definition table.
This means that,
unless the cascade results in a value,
the value will be determined by inheritance.
<p>
<dfn id="inherit">Inheritance</dfn> propagates property values from parent elements to their children.
The <dfn>inherited value</dfn> of a property on an element
is the <i>computed value</i> of the property on the element's parent element.
For the root element,
which has no parent element,
the <i>inherited value</i> is the <i>initial value</i> of the property.
<p>
Pseudo-elements inherit according to a fictional tag sequence described for each pseudo-element [[!SELECT]].
<p class='note'>
Note that inheritance follows the document tree and is not intercepted by <a href="http://www.w3.org/TR/CSS21/visuren.html#box-gen">anonymous boxes</a>,
or otherwise affected by manipulations of the box tree.
<p>
If the <i>cascaded value</i> of a property is the <dfn id="inherit-keyword">''inherit''</dfn> keyword,
the <i>inherited value</i> becomes the property's <i title="specified value">specified</i> and <i>computed values</i>.
<p class='issue'>
Not sure if the latter is correct, or if it should be just the specified value (matching the 2.1 errata).
<h4 id="default">
Rolling back the cascade: the ''default'' keyword</h4>
<p>
CSS Cascading and Inheritance Level 3 introduces the <dfn id="default-keyword">''default''</dfn> keyword
as a <a href="h 1891 ttp://www.w3.org/TR/css3-values/#common-keywords">CSS-wide keyword</a>
accepted by all properties.
<p>
If the <i>cascaded value</i> is the ''default'' keyword,
then all declarations in the <i>origin</i> level to which it belongs are discarded from the cascade,
resulting in a new <i>cascaded value</i>.
For this purpose, all author-originating styles
(author and override, both normal and important)
are treated as belonging to the same <i>origin</i> level.
This continues until the <i>cascaded value</i> is not ''default''
or until the <i>output of the cascade</i> is empty.
<p class="issue">
This definition might need tweaking to sensibly handle animations.
See <a href="http://lists.w3.org/Archives/Public/www-style/2012Dec/0270.html">dbaron's message</a>.
<h4 id='no-value'>
When There Is No Cascaded Value</h4>
<p>
Sometimes, the <i>output of the cascade</i> is an empty list,
and so there is no cascaded value.
F32F
<p>
In this case,
if the property is inherited
(as defined by the property's definition table)
and the element has a parent,
the specified value is the computed value of the same property on the element's parent.
<p>
Otherwise,
the specified value is the property's initial value,
as defined by the property's definition table.
<h2 id="value-stages">
Stages of Value Computation</h2>
<p>
Once a user agent has parsed a document and constructed a document tree,
it must assign,
to every element in the tree,
and correspondingly to every box in the formatting structure,
a value to every property that applies to the target media type.
<p>
The final value of a CSS3 property for a given element or box
is the result of a four-step calculation:
<ul>
<li>
First, cascading and inheritance yields the <i>specified value</i>.
<li>
Second, relative values are computed into absolute values as far as possible without formatting the document,
thereby yielding the <i>computed value</i>.
<li>
The computed value is transformed into the <i>used value</i> in the formatting process.
<li>
Finally, the used value is transformed to the <i>actual value</i>
based on constraints of local environment.
</ul>
<h3 id="specified">
Finding the specified value</h3>
<p>
The <dfn>specified value</dfn> is the output of the <a href="#cascade-and-inheritance">cascading and inheritance process</a>.
<p>
The cascading and inheritance process guarantees that a <i>specified value</i> exists for every property on every element.
<h3 id="computed">
Finding the computed value</h3>
<p>
A <i>specified value</i> can be either absolute (i.e., not relative to another value, as in 'red' or '2mm') or relative (i.e., relative to another value, as in 'auto', '2em').
<p>
For absolute values,
no extra processing is needed to find the computed value.
For relative values, on the other hand,
computation is necessary to find the computed value:
percentages must be multiplied by a reference value
(each property defines which value that is),
values with relative units
(em, ex, vh, vw)
must be made absolute by multiplying with the appropriate reference size,
certain keywords
(e.g., 'smaller', 'bolder')
must be replaced according to their definitions,
and valid relative URLs must be resolved to become absolute.
See examples (f), (g) and (h) in the <a href="#stages-examples">table below</a>.
<p>
The <dfn>computed value</dfn> is the result of resolving the <i>specified value</i>
as defined in the "Computed Value" line of the property definition table.
<p class="note">
Generally, this means resolving the <i>specified value</i>
insofar as possible without formatting the document.
In practice, the constraints are somewhat stricter.
Computed values generally don't depend on resolving network requests,
and we try to ensure they're based solely on data from the element and its parent.
<p class="note">
The <i>computed value</i> is the value that is transferred from parent to child during <i>inheritance</i>.
<p>
The <i>computed value</i> exists even when the property does not apply
(as defined by the "Applies To" line).
However, some properties may define the <i>computed value</i> of a property for an element
to depend on whether the property applies to that element.
<h3 id='used'>
Finding the used value</h3>
<p>
<i>Computed values</i> 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 <dfn>used value</dfn> is the result of taking the <i>computed value</i>
and resolving any remaining dependencies into an absolute value.
<h3 id="actual">
Finding the actual value</h3>
<p>
A <i>used value</i> is in principle ready to be used,
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.
Also, the font size of an element may need adjustment based on the availability of fonts
or the value of the 'font-size-adjust' property.
The <dfn>actual value</dfn> is the used value after any such approximations have been made.
<p class="note">
By probing the actual values of elements,
much can be learned about how the document is laid out.
However, not all information is recorded in the actual values.
For example, the actual value of the 'page-break-after' property
does not reflect whether there is a page break or not after the element.
Similarly, the actual value of 'orphans'
does not reflect how many orphan lines there is in a certain element.
See examples (j) and (k) in the <a href="#stages-examples">table below</a>.
<h3 id="stages-examples">
Examples</h3>
<table class="data">
<thead>
<tr>
<th>
<th>Property
<th>Winning declaration
<!-- <th>Cascaded value -->
<th>Specified value
<th>Computed value
<th>Used value
<th>Actual value
<tbody>
<tr>
<td>(a)
<th>'text-align'
<td><code class="declaration">text-align: left</code>
<!-- <td>''left''-->
<td>''left''
<td>''left''
<td>''left''
<td>''left''
<tr>
<td>(b)
<th>'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width'
<td><code class="declaration">border-width: inherit</code>
<!-- <td>''inherit'' -->
<td class="say">''4.2px''
<td>''4.2px''
<td>''4.2px''
<td>''4px''
<tr>
<td>(c)
<th>'width'
<td><small>(none)</small>
<!-- <td><small>(none)</small>-->
<td>''auto'' <small>(initial&nbsp;value)</small>
<td>''auto''
<td>''120px''
<td>''120px''
<tr>
<td>(d)
<th>'list-style-position'
<td><code class="declaration">list-style-position: inherit</code>
<!-- <td>''inherit'' -->
<td class="say">''inside''
<td>''inside''
<td>''inside''
<td>''inside''
<tr>
<td>(e)
<th>'list-style-position'
<td><code class="declaration">list-style-position: initial</code>
<!-- <td>''initial''-->
<td>''outside'' <small>(initial&nbsp;value)</small>
<td>''outside''
<td>''outside''
<td>''outside''
<tr>
<td>(f)
<th>'font-size'
<td><code class="declaration">font-size: 1.2em</code>
<!-- <td>''1.2em''-->
<td>''1.2em''
<td class="say">''14.1px''
<td>''14.1px''
<td>''14px''
<tr>
<td>(g)
<th>'width'
<td><code class="declaration">width: 80%</code>
<!-- <td>''80%''-->
<td>''80%''
<td>''80%''
<td class="say">''354.2px''
<td>''354px''
<tr>
<td>(h)
<th>'width'
<td><code class="declaration">width: auto</code>
<!-- <td>''auto''-->
<td>''auto''
<td>''auto''
<td class="say">''134px''
<td>''134px''
<tr>
<td>(i)
<th>'height'
<td><code class="declaration">height: auto</code>
<!-- <td>''auto''-->
<td>''auto''
<td>''auto''
<td class="say">''176px''
<td>''176px''
<tr>
<td>(j)
<th>'page-break-after'
<td><small>(none)</small>
<!-- <td><small>(none)</small>-->
<td>''auto'' <small>(initial&nbsp;value)</small>
<td>''auto''
<td>''auto''
<td>''auto''
<tr>
<td>(k)
<th>'orphans'
<td><code class="declaration">orphans: 3</code>
<!-- <td>''3''-->
<td>''3''
<td>''3''
<td>''3''
<td>''3''
</table>
<h2>Conformance</h2>
<p>[TBD]
<h2 id="changes">
Changes</h2>
<h3 id="changes-2012">
Changes since the 15 December 2005 Working Draft</h3>
<p>The following major changes were made to this specification since the
<a href="http://www.w3.org/TR/2005/WD-css3-cascade-20051215/">15 December 2005 Working Draft</a>:
<ul>
<li>Dropped alternate style sheets feature.
< 4D7E /div>
<li>Resync'd spec against <a href="http://www.w3.org/TR/CSS21/">CSS2.1</a>.
<li>Imported and updated <a href="#value-stages">Stages of Value Computation</a> section
from old drafts of <a href="http://www.w3.org/TR/css3-values/">CSS Values and Units</a>.
<li>Introduced <a href="#cascade-scope">scoping</a> per <a href="http://www.w3.org/mid/4F570227.8060707@mit.edu">Boris Zbarsky's suggestion</a>.
<li>Introduced ''default'' keyword.
<li>Introduced 'all' shorthand.
</ul>
<h2 class="no-num" id="acknowledgments">Acknowledgments</h2>
<p>David Baron and Boris Zbarsky contributed to this specification.
<h2 class=no-num id='references'>References</h2>
<h3 class="no-num" id="normative-references">Normative references</h3>
<!--normative-->
<h3 class="no-num" id="other-references">Other references</h3>
<!--informative-->
<h2 class="no-num" id="index">Index</h2>
<!--index-->
<h2 class="no-num" id="property-index">Property index</h2>
<!-- properties -->
</body>
</html>