gtxyzz

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

gtxyzz web技术 2022-07-07 578浏览 0

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

实例

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

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

定义和用法

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

CSS 语法

all: initial|inherit|unset;

属性值

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


属性值
描述
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!

继续浏览有关 css 的文章
发表评论