2023-12-29 css之行内存在多个!important权重时哪个!important优先级最高?==》显示最后一个

发布时间 2023-12-29 20:04:25作者: 哎呦你可棒棒了

假如div里面有多个!important权重的样式类名.a和.b,哪个优先级最高?

<div class="a b"></div>
.a {
  display: block !important;  
}

.b {
  display: none !important;  
}

答案:b。

谁的!important写在最后,谁就生效。