This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

CSS keywords

Summary

Many CSS properties have specific keywords which may be used as values; in addition, the keywords initial and inherit may be used as the value of any CSS property.

The keywords relevant to a specific CSS property are defined in its property page. All keywords meet the requirements of CSS identifiers, and are case sensitive. Keywords should never be quoted.

CSS-wide keywords

Certain keywords can be used for any CSS property value:

  • inherit copies the value of the property in effect for the element’s parent.

  • initial represents the initial (or default) value for the property, over-riding any values set earlier in the cascade; initial values are defined on each property’s definition; it is not supported in Internet Explorer.

  • unset is equivalent to inherit if the property is normally inherited, or initial otherwise; it is not currently supported in most browsers (although Firefox implements it).

Examples

body{
    height:100%;
    background-image:radial-gradient(ellipse , yellow, orange 30%);
    text-align:center;
    /* a property-specific keyword */
}
h1 {
   background-image:inherit;
   /* inherit a not-normally inherited property
      (note that there is a second gradient that fits the
      heading box)
   */
}
p {
   text-align:initial;
   /* over-ride an inheritied property,
      if your browser supports the initial keyword */
}
a {
  color: inherit !important;
  /* over-ride a user stylesheet property */

  text-decoration: unset !important;
  /* over-ride a user stylesheet property,
     if your browser supports the unset keyword */
}

View live example

Related specifications

CSS Cascading and Inheritance Level 3
W3C Candidate Recommendation
CSS Values and Units Module Level 3
W3C Candidate Recommendation
CSS 2.1
W3C Recommendation