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

How to use css all attribute?

青灯夜游
青灯夜游Original
2019-02-15 14:38:473357browse

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;

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>

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!

Statement:
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