CSS all 属性 继承父元素,或应用于所有值

 2022-05-29    456  

CSS all 属性 继承父元素,或应用于所有值

实例

CSS all 属性 继承父元素,或应用于所有值

将应用于元素或元素父元素的所有属性更改为其初始值:

div {
  background-color: yellow;
  color: red;
  all: initial;
}

定义和用法

all 属性将除 unicode-bidi 和 direction 之外的所有属性重置为其初始值或继承的值。

默认值: none
继承:
动画制作: 不支持。请参阅:动画相关属性。
版本: CSS3
JavaScript 语法: object.style.all="initial"

CSS 语法

all: initial|inherit|unset;

属性值

描述
initial 将此属性设置为其默认值。参阅 initial。
inherit 从其父元素继承此属性。参阅 inherit。
unset 如果可继承,则将应用于元素或元素父元素的所有属性更改为其父值,否则将其更改为初始值。



未设置 all 属性:

Shanghai is one of the four direct-administered municipalities of the People's Republic of China. Welcome to Shanghai!

all: inherit:

Shanghai is one of the four direct-administered municipalities of the People's Republic of China. Welcome to Shanghai!

all: initial:

Shanghai is one of the four direct-administered municipalities of the People's Republic of China. Welcome to Shanghai!

all: unset:

Shanghai is one of the four direct-administered municipalities of the People's Republic of China. Welcome to Shanghai!

  •  标签:  

原文链接:https://77isp.com/post/1021.html

=========================================

https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。