unset
The unset CSS keyword resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. In other words, it behaves like the inherit keyword in the first case, when the property is an inherited property, and like the initial keyword in the second case, when the property is a non-inherited property.
unset can be applied to any CSS property, including the CSS shorthand property all.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 41 | 13 | 27 | 9.1 | 41 | 9.3 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Syntax
CSS
.reset-component {
all: unset;
}
.reset-color {
color: unset; /* Inherited from parent */
} Live demo
Use cases
-
Using unset
The unset CSS keyword resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.
Cautions
- May not be supported in older browsers.
Accessibility
- Make sure visual changes are conveyed appropriately to assistive technology.