在调用 mixin 时,如果在后面追加 !important 关键字,就可以将 mixin 里面的所有属性都标记为 !important。如,以下Less代码:

  1. .mixin() {
  2.   color: #900;
  3.   background: #F7BE81;
  4. }
  5. h2 {
  6.   .mixin() !important;
  7. }

编译后的CSS代码为:

  1. h2 {
  2.   color: #900 !important;
  3.   background: #F7BE81 !important;
  4. }

相关文章:

  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-29
  • 2022-02-17
  • 2021-12-29
  • 2021-11-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2021-08-03
相关资源
相似解决方案