zjffun blog

CSS initial, inherite, unset

更新于 写于 前端

initial

设置属性值为默认值

inherite

设置属性值为父元素的计算值

unset

相当于继承属性设置为inherit,非继承属性设置为initial

css
.some-class {
  color: unset; /* will be equal to 'inherit' value */
  display: unset; /* will be equal to 'initial' value*/
}
css
/* Good */
.common-content * {
  all: unset;
}

Understanding the “Initial”, “Inherit” and “Unset” CSS Keywords