首页 > 代码库 > Less-css扩展多样式

Less-css扩展多样式

//扩展Extend

Use Method:以在study上扩展多个的样式为例

//Share style 1
.style1{
    width:200px;
    height:15px;
    color:#ffffff;
}
//Share style 2
.style2{
    float:left;
    background:red;
}

//grammar 1
.study{
    &:extend(.style1,.style2);
}

//grammar 2
.study:extend(.style1,.style2){}

//grammar 3
.study:extend(.style1):extend(.style2){}

//输出css
.style1,
.study {
  width: 200px;
  height: 15px;
  color: #ffffff;
}
.style2,
.study {
  float: left;
  background: red;
}

 

Less-css扩展多样式