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

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.

css
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
Chrome – Full support
Chrome 1 (Release date: 2008-12-11)
footnote Full support
Edge – Full support
Edge 13 (Release date: 2015-11-12)
footnote Full support
Firefox – No support
Firefox 1 – 23 (Release date: 2004-11-09)
prefix
footnote Removed in 24 and later
prefix Implemented with the vendor prefix: -moz-
Firefox – Full support
Firefox 19 (Release date: 2013-02-19)
footnote Full support
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 1.2 (Release date: 2004-02-02)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote Full support
Firefox for Android – No support
Firefox for Android 4 – 23 (Release date: 2011-03-29)
prefix
footnote Removed in 24 and later
prefix Implemented with the vendor prefix: -moz-
Firefox for Android – Full support
Firefox for Android 19 (Release date: 2013-02-19)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 1 (Release date: 2007-06-29)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote Full support
WebView Android – Full support
WebView Android 4.4 (Release date: 2013-12-09)
footnote Full support
WebView on iOS – Full support
WebView on iOS 1 (Release date: 2007-06-29)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Requires a vendor prefix or different name for use.
Has more compatibility info.

See also