初学:less mixin 和 scss mixin的不同
scss是sass的升级版,
在codepen中,使用测试的是scss模式
scss 需要用 @mixin box 定义,然后用 @include box 调用,box不能是一个类,不能加.
@mixin box {
width: 100px;
height: 100px;
}
.box1 {
@include box;
}
less 直接用.box 写css,然后直接调用
.box {
width: 100px;
height: 100px;}
.box1 {
.box;
.box(); /*括弧也可以调用*/
}
个人认为,scss的写法,更加清晰