`initial` CSS keyword
Baseline Widely available
This feature is well established and works across many devices and browser versions. It's been available across browsers since November 2015.
The initial CSS keyword applies the initial (or default) value of a property to an element. It can be applied to any CSS property, including the CSS shorthand property all. With all set to initial, all CSS properties can be restored to their respective initial values in one go instead of restoring each one separately.
On inherited properties, the initial value may be unexpected. You should consider using the inherit, unset, revert, revert-layer, or revert-rule keywords instead.
Examples
Basic usage
In this example, we use the initial keyword to reset an element's color and font-size property values.
HTML
<p>
This text is red and large.
<em
>This text is in the initial color (typically black) and initial size
(typically 16px).</em
>
This is red and large again.
</p>
CSS
We set color and font-size on the <p> element, then set those properties to initial on the <em> element to reset them.
p {
color: red;
font-size: 2rem;
}
em {
color: initial;
font-size: initial;
}
Result
With the initial keyword in this example, the color and font-size values on the em element are restored to the initial values for color and font-size, respectively.
Specifications
| Specification |
|---|
| CSS Cascading and Inheritance Level 4 # initial |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on iOS | Samsung Internet | WebView Android | WebView on iOS | |
initial |
1 |
13 |
19
1–24
|
15 |
1.2 |
18 |
19
4–24
|
14 |
1 |
1.0 |
4.4 |
1 |
See also
-
inherit,revert,revert-layer,revert-rule, andunsetkeywords all- Inheritance
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/initial