CSS defines a number of different property values that allow assigning some sort of default. The kind of default can vary and is controlled by the particular value used. See below for details.
initial |
This causes a property to take its default value, as defined in the property's definition table in the
specification.
E.g. you can see in the spec height has an initial value of auto , and
color has an initial value which is browser dependent.
Note initial values defined in a properties definition table are not the same as the values assigned by user-agent stylesheets, the user-agent stylesheets are on top. E.g. the initial value of display is inline , but user-agent stylesheets will normally set this to
block for div s.
|
||||||
inherit |
This causes a property to take the computed value of the property from the parent element. | ||||||
unset |
This causes a property to do what it would do by default if nothing was set, either inherit or take on its
initial value.
Note that all properties have an initial value even if they inherit by default. E.g. font-size has an initial value of medium , but it also inherits by default. So if
this was set to initial it's value would be medium , but if it was set to
unset its value would inherit.
|
||||||
revert |
This property is similar to unset , but where unset will always set a property back
to its specification default, revert reverts styles applied to a property in the current
style origin. If any styles exist in the parent style origin then they will still apply (unless that
style origin also sets revert , etc.). This allows a layered approach to reverting a style.
A style origin is just the location that styles can come from. There are three types of style origin, they are listed below from bottom to top of the styles stack. The are reverted in reverse order, i.e. first site origin, then user origin, then user-agent origin:
|
The CSS all
property allows you to assign one of the above default values to all the properties of an
element.