CSS Reference Data Type

initial 6y6b3

The initial CSS keyword is used to apply a property’s initial value as its specified value (value specified by the CSS author). This means that no matter what the cascaded or inherited value of the property is, it will be “reset” to its default initial value if it takes this keyword. 1f3d3y

All CSS properties have initial values, hence, this keyword can be used with any CSS property.

Some CSS properties inherit their values from the cascading nature of CSS. For example, if you set a text color of an element, then all the descendants of that element will inherit the same text color. In such a case, you may want to reset the color of one of the descendants instead of having it inherit the color from its parent, so the initial keyword could be used to do just that. The same applies for properties that are not inherited, but you still want to reset their values to their initial values.

Examples 2t4m6h

Assume that you have a container and that you have set the text color of that container to be of a certain color. The following resets the text color of all .original paragraphs inside that container to their default text color.

p.original {
    color: initial;
}
                

The following example will style all h3 tags and give them an italic font style. We’ll use the initial keyword to reset the font style to its initial value (which is normal) for h3 tags that are found inside the sidebar.

h3 {
    font-style: italic;
}

.sidebar h3 {
    font-style: initial;
}
                

Browser f3k20

CSS initial value 1j182b

A CSS value that will apply a property's initial value as defined in the CSS specification that defines the property

W3C Candidate Recommendation

ed from the following versions:

Desktop 544w68

  • 4
  • 19
  • No
  • 15
  • 3.2

Mobile / Tablet 60z3k

  • 4.0
  • 2.3
  • No
  • 66
  • 60

* denotes prefix required.

  • ed:
  • Yes
  • No
  • Partially
  • Polyfill

Stats from caniuse.com

Notes 1y2t2j

The initial keyword is ed without prefixes starting Firefox v24.

Written by

Last updated January 10, 2020 at 9:17 am by Hui Jing Chen

Do you have a suggestion, question or want to contribute? Submit an issue.