Less从入门到精通——!important关键字(附源码、学习视频和笔记)

完整学习视频及资料在这里哦~
链接:https://pan.baidu.com/s/1XHxElnc2N-qwg2f2J30Qyw
提取码:4k8t

关键字(important)

!important 关键字:在调用的混合集后面追加 !important 关键字,可以使混合集里面的所有属性都继承 !important。这样可以提升样式的权重以至于不被层叠。

.bg(){
     200px;
    height: 200px;
}
div{
    .bg();
}
div{
    .bg()!important;
}
// 输出
div {
   200px;
  height: 200px;
}
div {
   200px !important;
  height: 200px !important;
}
原文地址:https://www.cnblogs.com/Monster-su/p/14092676.html