Home > Web Front-end > CSS Tutorial > How to use css all attribute?

How to use css all attribute?

青灯夜游
Release: 2019-05-25 15:26:29
Original
3383 people have browsed it

The all attribute is used to reset all attributes except unicode-bidi and direction to their initial values ​​or values ​​inherited from the parent element.

How to use css all attribute?

CSS all property

all property is actually the abbreviation of all CSS properties, which means, all The CSS properties are the same; however, the two CSS properties unicode-bidi and direction are not included.

Function: all attribute will reset all attributes except unicode-bidi and direction.

Syntax:

all: initial|inherit|unset;
Copy after login

initial: Changes all properties applied to the element or the element's parent to their initial values.

inherit: Changes all properties applied to an element or the element's parent to their parent value

unset: Changes all properties applied to an element or the element's parent to theirs Parent values ​​(if they are inheritable), or changed to their initial values ​​(if not inheritable).

Note: Internet Explorer and Safari browsers do not support the all attribute.

Example of using CSS all attribute

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<style> 
html {
  font-size: small;
  color: blue;
}
p{
font-size: 20px;
color: #000;
}
#ex1 {
  background-color: yellow;
  color: red;
}
#ex2 {
  background-color: yellow;
  color: red;
  all: inherit;
}
#ex3 {
  background-color: yellow;
  color: red;
  all: initial;
}
#ex4 {
  background-color: yellow;
  color: red;
  all: unset;
}
</style>
</head>
<body>
<p>没有设置all 属性:</p>
<div id="ex1">PHP中文网!!!</div>
<p>all: inherit:</p>
<div id="ex2">PHP中文网!!!</div>
<p>all: initial:</p>
<div id="ex3">PHP中文网!!!</div>
<p>all: unset:</p>
<div id="ex4">PHP中文网!!!</div>
</body>
</html>
Copy after login

Rendering:

How to use css all attribute?

Reference for this article: https://www.html.cn/book/css/properties/all.htm

The above is the detailed content of How to use css all attribute?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template