The blue ideals of initial, inherit, unset, revert, and all-little matches
* Directory [1] initial [2] inherit [3] unset [4] revert [5] all
Previous
In CSS, there are four keywords that can be theoretically applied to any CSS attribute. They are initial (initial), inherit (inheritance), unset (unset), and revert (restoration ). The value of all can only be the preceding four keywords. This article describes initial, inherit, unset, revert, and all
Initial
Indicates the initial default value of an element attribute (defined by the official CSS Specification)
Compatibility: not supported by IE
[Note] the initial default values of each attribute are now
// The default value of display defined in the official CSS specification is inline.
Test 1
Text
Test 2
Text
Inherit
The calculated value of the attribute corresponding to the direct parent element of the element.
Compatibility: IE7-not supported
Test 1
Test 2
Unset
Unset is more complex than initial and inherit. Indicates that if this property can be inherited by default, the value is inherit; otherwise, the value is initial. In fact, setting unset is equivalent to not setting
Compatibility: IE is not supported, safari9 is not supported, ios9.2 is not supported, android4.4.4 is not supported
[The style can be inherited by default]
colorcursordirectionfontletter-spacingline-heightlist-styletext-aligntext-indenttext-shadowtext-transformwhite-spaceword-breakword-spacingword-wrapwriting-mode
// The elements whose content is test 1 and whose content is Test 2 have the same style
Test 1
Test 2
Revert
The default value of the element attribute defined in the style sheet. If you explicitly set a style sheet, follow this setting; otherwise, follow the style settings in the style sheet defined by the browser; otherwise, it is equivalent to unset.
Compatibility: only supported by safari9.1 + and ios9.3 +
All
Indicates resetting the attribute values of all CSS attributes except unicode-bidi and ction. The values can only be initial, inherit, unset, and revert.
Compatibility: IE is not supported, safari9 is not supported, ios9.2 is not supported, android4.4 is not supported
Test text
[1] WHEN all: initial, all properties of. in take the default value
border:none;padding:0;color:black;
[2] WHEN all: inherit, all attributes of. in are inherited from the parent element.
border:1px solid black;padding:20px;color:red;
[3] WHEN all: unset, all attributes of. in are equivalent to non-set values. default values can be inherited, and default values cannot be inherited.
border:none;padding:0;color:red;