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

Latest commit

 

History

History
1237 lines (1032 loc) · 86.7 KB

File metadata and controls

1237 lines (1032 loc) · 86.7 KB
<h3 class="heading settled heading" data-level=7.1 id=initial-values><span class=secno>7.1 </span><span class=content>
Initial Values</span><a class=self-link href=#initial-values></a></h3>
<p>
Each property has an <dfn data-dfn-type=dfn data-export="" id=initial-value>initial value<a class=self-link href=#initial-value></a></dfn>,
defined in the property’s definition table.
If the property is not an <a data-link-type=dfn href=#inherited-property title="inherited property">inherited property</a>,
and the <a data-link-type=dfn href=#cascade title=cascade>cascade</a> does not result in a value,
then the <a data-link-type=dfn href=#specified-value title="specified value">specified value</a> of the property is its <a data-link-type=dfn href=#initial-value title="initial value">initial value</a>.
<h3 class="heading settled heading" data-level=7.2 id=inheriting><span class=secno>7.2 </span><span class=content>
Inheritance</span><a class=self-link href=#inheriting></a></h3>
<p>
<dfn data-dfn-type=dfn data-export="" id=inheritance>Inheritance<a class=self-link href=#inheritance></a></dfn> propagates property values from parent elements to their children.
The <dfn data-dfn-type=dfn data-export="" id=inherited-value>inherited value<a class=self-link href=#inherited-value></a></dfn> of a property on an element
is the <a data-link-type=dfn href=#computed-value title="computed value">computed value</a> of the property on the element’s parent element.
For the root element,
which has no parent element,
the <a data-link-type=dfn href=#inherited-value title="inherited value">inherited value</a> is the <a data-link-type=dfn href=#initial-value title="initial value">initial value</a> of the property.
<p>
(Pseudo-elements inherit according to a fictional tag sequence described for each pseudo-element <a data-biblio-type=normative data-link-type=biblio href=#select title=select>[SELECT]</a>.)
<p>
Some properties are <dfn data-dfn-type=dfn data-export="" id=inherited-property title="inherited property">inherited properties<a class=self-link href=#inherited-property></a></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>
A property can also be explicitly inherited. See the <a class=css data-link-type=maybe href=#valuedef-inherit title=inherit>inherit</a> keyword.
<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.
<h3 class="heading settled heading" data-level=7.3 id=defaulting-keywords><span class=secno>7.3 </span><span class=content>
Explicit Defaulting</span><a class=self-link href=#defaulting-keywords></a></h3>
<p>
Several CSS-wide property values are defined below;
declaring a property to have these values explicitly specifies a particular defaulting behavior.
As specified in <a href=http://www.w3.org/TR/css3-values/#common-keywords>CSS Values and Units Level 3</a> <a data-biblio-type=normative data-link-type=biblio href=#css3val title=css3val>[CSS3VAL]</a>,
all CSS properties can accept these values.
<h4 class="heading settled heading" data-level=7.3.1 id=initial><span class=secno>7.3.1 </span><span class=content>
Resetting a Property: the <a class=css data-link-type=maybe href=#valuedef-initial title=initial>initial</a> keyword</span><a class=self-link href=#initial></a></h4>
<p>
If the <a data-link-type=dfn href=#cascaded-value title="cascaded value">cascaded value</a> is the <dfn class=css-code data-dfn-for=all data-dfn-type=value data-export="" id=valuedef-initial><a class=css data-link-type=maybe href=#valuedef-initial title=initial>initial</a><a class=self-link href=#valuedef-initial></a></dfn> keyword,
the property’s <a data-link-type=dfn href=#initial-value title="initial value">initial value</a> becomes its <a data-link-type=dfn href=#specified-value title="specified value">specified value</a>.
<h4 class="heading settled heading" data-level=7.3.2 id=inherit><span class=secno>7.3.2 </span><span class=content>
Explicit Inheritance: the <a class=css data-link-type=maybe href=#valuedef-inherit title=inherit>inherit</a> keyword</span><a class=self-link href=#inherit></a></h4>
<p>
If the <a data-link-type=dfn href=#cascaded-value title="cascaded value">cascaded value</a> of a property is the <dfn class=css-code data-dfn-for=all data-dfn-type=value data-export="" id=valuedef-inherit><a class=css data-link-type=maybe href=#valuedef-inherit title=inherit>inherit</a><a class=self-link href=#valuedef-inherit></a></dfn> keyword,
the <a data-link-type=dfn href=#inherited-value title="inherited value">inherited value</a> becomes the property’s <a data-link-type=dfn href=#specified-value title="specified value">specified</a> and <a data-link-type=dfn href=#computed-value title="computed values">computed values</a>.
<h4 class="heading settled heading" data-level=7.3.3 id=inherit-initial><span class=secno>7.3.3 </span><span class=content>
Erasing All Declarations: the <a class=css data-link-type=maybe href=#valuedef-unset title=unset>unset</a> keyword</span><a class=self-link href=#inherit-initial></a></h4>
<p>
If the <a data-link-type=dfn href=#cascaded-value title="cascaded value">cascaded value</a> of a property is the <dfn class=css-code data-dfn-for=all data-dfn-type=value data-export="" id=valuedef-unset><a class=css data-link-type=maybe href=#valuedef-unset title=unset>unset</a><a class=self-link href=#valuedef-unset></a></dfn> keyword,
then if it is an inherited property, this is treated as <a class=css data-link-type=maybe href=#valuedef-inherit title=inherit>inherit</a>,
and if it is not, this is treated as <a class=css data-link-type=maybe href=#valuedef-initial title=initial>initial</a>.
This keyword effectively erases all <a data-link-type=dfn href=#declared-value title="declared values">declared values</a> occurring earlier in the <a data-link-type=dfn href=#cascade title=cascade>cascade</a>,
correctly inheriting or not as appropriate for the property
(or all longhands of a <a data-link-type=dfn href=#shorthand-property- title=shorthand>shorthand</a>).
<h2 class="heading settled heading" data-level=8 id=changes><span class=secno>8 </span><span class=content>
Changes</span><a class=self-link href=#changes></a></h2>