initial
Quick Summary for initial
The
initial
CSS keyword applies the initial (or default) value of a property to an element. It can be applied to any CSS property. This includes the CSS shorthand all
, with which initial
can be used to restore all CSS properties to their initial state.
Code Usage for initial
<p> <span>This text is red.</span> <em>This text is in the initial color (typically black).</em> <span>This is red again.</span> </p>
More Details for initial
initial
The initial
CSS keyword applies the initial (or default) value of a property to an element. It can be applied to any CSS property. This includes the CSS shorthand all
, with which initial
can be used to restore all CSS properties to their initial state.
On inherited properties, the initial value may be unexpected. You should consider using the inherit
, unset
, or revert
keywords instead.
Examples
Using initial to reset color for an element
HTML<p> <span>This text is red.</span> <em>This text is in the initial color (typically black).</em> <span>This is red again.</span> </p>
CSS p { color: red; } em { color: initial; }
ResultSpecifications
Specification |
---|
CSS Cascading and Inheritance Level 3 # initial |
See also
Useunset
to set a property to its inherited value if it inherits, or to its initial value if not. Use revert
to reset a property to the value established by the user-agent stylesheet (or by user styles, if any exist). Use inherit
to make an element's property the same as its parent. The all
property lets you reset all properties to their initial, inherited, reverted, or unset state at once. Last modified: Feb 21, 2022, by MDN contributors
Select your preferred language English (US)DeutschEspañolFrançais日本語한국어PolskiPortuguês (do Brasil)Русский中文 (简体) Change language Posted in
12:22 am, February 22, 2022
Add Comment
Other Items in CSS
rgb()
rgba()
:right
right
@right-bottom
:root
rotate
rotate()
rotate3d()
rotateX()
rotateY()
rotateZ()
row-gap
ruby-align
ruby-position
saturate()
scale
scale()
scale3d()
scaleX()
scaleY()
scaleZ()
:scope
scroll-behavior
scroll-margin
scroll-margin-block
scroll-margin-block-end
scroll-margin-block-start
scroll-margin-bottom
scroll-margin-inline
scroll-margin-inline-end
scroll-margin-inline-start
scroll-margin-left
scroll-margin-right
scroll-margin-top
scroll-padding
scroll-padding-block
scroll-padding-block-end
scroll-padding-block-start
scroll-padding-bottom
scroll-padding-inline
scroll-padding-inline-end
scroll-padding-inline-start
scroll-padding-left
scroll-padding-right
scroll-padding-top
scroll-snap-align
scroll-snap-stop
scroll-snap-type
@scroll-timeline