在 Less 中,!important 关键字会将修饰的混入中的所有属性都标记为 !important。例子:
.foo (@bg: #f5f5f5, @color: #900) {
background: @bg;
color: @color;
}
.unimportant {
.foo();
}
.important {
// .foo 中的 background 和 color 将添加 !important 标记
.foo() !important;
}编译 less,输出的 CSS 如下:
.unimportant {
background: #f5f5f5;
color: #900;
}
.important {
background: #f5f5f5 !important;
color: #900 !important;
}