继承多个选择器
在编写的过程中,往往会遇到一个选择器要继承多个选择器的样式,那么这应该怎么办呢?看看下面的小实例吧。
SCSS代码
.one {
width:100px;height:100px;
}
.two {
/*继承的样式*/
@extend .one;
@extend .three;
/*独立的样式*/
background:red;
border:5px solid #000;
}
.three {
padding:10px;
}
编译后的CSS代码
.one, .two {
width: 100px;
height: 100px;
}
.two {
background: red;
border: 5px solid #000;
}
.three, .two {
padding: 10px;
}