新手问题 sass 的继承和 mixin 有什么区别?

yakczh · April 26, 2013 · Last by krazy replied at April 26, 2013 · 3311 hits

.center{

margin:0 auto;

}

比如定义样式

@extend .center;

@include .center;

的区别是什么?

不能写 @include .center

@include 后面带的是 module 名称,@extend 后面带的是 css 选择器

@extend通过加选择器来复用 @include通过加 css 规则,给每个选择器下面 drop in 一份儿代码

涉及变量就@include 然后传参.... 其他的就直接@extend

You need to Sign in before reply, if you don't have an account, please Sign up first.