A CSS initial value is the value defined as a property's starting point by its specification. It participates in defaulting when an element has no other specified value under the applicable rules. It is distinct from a browser's default stylesheet declaration and from the value obtained by CSS inheritance.[ref]
For example, the initial value of display is inline, while a browser normally supplies styling that makes a paragraph block-level. Setting p { display: initial; } requests the property's initial value, rather than restoring the browser's usual paragraph appearance. The paragraph's HTML element semantics remain separate from that display choice.
The keyword initial explicitly requests this starting value. inherit requests the parent's computed value instead, and unset chooses inheritance for inherited properties and the initial value for non-inherited properties. Thus these keywords can produce different results even when they appear in the same selector and win the same CSS cascade comparison.[ref]
Initial values also need their normal processing. A width initially set to auto still requires the appropriate sizing algorithm; initial does not mean that every property begins as zero or already has a final pixel size. The sequence from defaulting through computation to the CSS used value explains how a specification-defined starting value becomes a concrete rendering.

Articles by others on the same topic (0)

There are currently no matching articles.