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.
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:
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!