The blue ideals of initial, inherit, unset, revert, and all-little matches

Source: Internet
Author: User
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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.