Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of the new property all of css3

Shulou Source: shulou.com Published: 2022-06-01 10:56:59 10月02日 Update

Editor to share with you what is the use of css3's new attribute all, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

The all attribute is actually an acronym for all CSS attributes, indicating what all CSS properties should do; however, the unicode-bidi and direction CSS attributes are not included. Therefore, we should be able to know what the all attribute does:

All attribute: all selected element attributes can be reset except for two attributes that control the orientation of the text: the direction attribute and the unicode-bidi attribute.

.demo {

All:unset

}

Its focus is to allow component-level style resets. Sometimes it is much easier to set the desired style from scratch than to modify the original style.

Let's take a look at the property values that can be set by the all property:

1. Initial: resets the attributes of all selected elements to the initial values defined in the CSS specification.

2. The inherit:selected element inherits the styles of all its parent elements, including styles that are usually not inheritable.

3. The unset:selected element inherits any inheritable value passed down from the parent element. If no inheritable values are available, the initial values of the CSS specification are used for each property.

Description:

Some properties in css do not explicitly define initial values in the specification, but allow users to set their own initial values, such as color and font family.

All is an abbreviated property because it allows us to use a single declaration to control the value of each CSS property at a time. However, unlike most abbreviated properties, there is no practical "longhand" version and no child attributes.

Let's take a look at the demonstration of all:

Html Code:

Changethisdiv'sallvalue.

Css Code:

.container {/ * inherit * /

Font-family:sans-serif

Font-size:1.5em

Text-align:center

Text-transform:uppercase

Text-shadow:1px1px1pxblack

}

.parent {

Color:green;/* inheritance * /

/ * do not inherit * /

Background-color:gainsboro

Width:80%

Padding:1em

Border:5pxsolid#E18728

}

The above is all the content of this article entitled "what is the use of all, a new attribute of css3?" thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Attributes elements styles articles two code content shorthand control different practical not very from scratch function single original most font actually actually Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL macOS Docker Microsoft Shulou Technology