less的extend 用法小记

49 阅读1分钟

less的extend用法 一般用法

.color{
    color:#fff
}
.red:extend(.color){
    background:red
}
//或者 
.red{
    &:extend(.color)
    background:red
}

但是 在父类里面是不生效的 需要加上父类

    .adminBox{
        .title{
            width:50px;
            height:50px;
            color:#333;
        }
        .secondTitle{
            &:extend(.adminBox .title);
            color:red
        }
    }

如果不加父类的话是不生效的