Resetting styles in CSS
CSS Cascading and Inheritance Level 3 specification that has recently reached the CR (Candidate Recommendation) status contains two important new features.
unsetvalue allows to reset value of a CSS property. The
unsetvalue is equivalent to
inheritfor inherited properties (e. g.
font-size), and to
initialfor non-inherited ones (e. g.
- Shorthand property (!)
allallows to set a value to all CSS properties supported by browser without need to list them explicitly.
Using both features in conjunction as
all: unset declaration should allow to easily and gracefully reach the result that is currently reached by using multiline rules inside “reset” stylesheets (e. g. reset.css).
Also, this will make it easier to embed third-party widgets to pages of websites by minimizing influence of site’s own styles to appearance of third-party widget. For such cases,
initial value may be more suitable than
unset since the former cancels entire inheritance chain: for example, this makes it possible for a separate block to have a font size that does not depend on font size of the
initial values effectively reset
display property to
You may also be interested in local CSS classes.