![Less的!important关键字 Less的!important关键字](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
Less的!important关键字
在调用 mixin 时,如果在后面追加 !important 关键字,就可以将 mixin 里面的所有属性都标记为 !important。如,以下Less代码:
.mixin() {
color: #900;
background: #F7BE81;
}
h2 {
.mixin() !important;
}
编译后的CSS代码为:
h2 {
color: #900 !important;
background: #F7BE81 !important;
}