我是SASS和编程语言的新手。
.row
{
@include make-row;
}
Run Code Online (Sandbox Code Playgroud)
在上面@include
,等于@import
在sass中起作用吗?您能否解释的功能@include
。
@import导入整个文件,@ include包含一段@mixin代码。它允许您创建可重用的代码。
@mixin example($color, $style, $weight) {
border: $color, $style, $weight;
width: 100px;
height: 100px
padding: 10px;
}
.box {
@include example(#000, solid, 1px);
}
Run Code Online (Sandbox Code Playgroud)
在 SASS 中,@include 与 mixins 相关,不要将其误认为是 @import,因为它们做了两个完全不同的事情。
@mixin blue-text {
color: blue;
}
span {
@include blue-text;
}
Run Code Online (Sandbox Code Playgroud)
你最终会得到:
span {
color: blue;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2234 次 |
最近记录: |