todo

1,嵌套语法:https://www.w3cschool.cn/less/nested_directives_bubbling.html

简单来说就是可以与html一样去写css,并且会继承其优先级

2,less扩展:extend(注意不可用于嵌套中)

h2 {
  &:extend(.style);
  font-style: italic;
}
.style {
  background: green;
}

等同于

h2 {
  font-style: italic;
}
.style,
h2 {
  background: green;
}

3,less混合:(与扩展类似)可用于嵌套中

.p1{
  color:red;
}
.p2{
  background : #64d9c0;
  .p1();
}
.p3{
   background : #DAA520;
  .p1;
}

等同于

.p1 {
  color: red;
}
.p2 {
  background: #64d9c0;
  color: red;
}
.p3 {
  background: #DAA520;
  color: red;
}

 

相关文章:

  • 2022-01-16
  • 2022-12-23
  • 2021-11-17
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
猜你喜欢
  • 2021-12-09
  • 2022-12-23
  • 2021-12-13
  • 2021-08-16
  • 2021-12-04
  • 2022-02-22
  • 2021-12-14
相关资源
相似解决方案