SCSS 中的 Mixin(一个类在另一个类中的属性)



在LESS中,我可以写出这样的东西:

.foo {
color: red;
}
.boo {
.foo();
background: blue;
}

将类.foo属性"包含"到.boo类中。

在 SCSS 中获得类似 beavior 的最简单、干净的方法是什么?

像这样尝试怎么样,

mixins.scss

@mixin flex($x: center, $y: center) {
display: flex;
align-items: $x;
justify-content: $y;
}

custom.scss

.classname {
@include flex(flex-start, space-between);
color: red;
}

使用@include

最新更新