我终于从 Susy One 过渡到 Susy 2 并且一直在为新语法苦苦挣扎。具体来说,将它与 Breakpoint mixin 一起使用。
在 Susy One 中,我有这个:
// Mobile First Settings
.grid-construct{
$total-columns: $bp-sm-columns;
$column-width: $bp-sm-column-width;
$gutter-width: $bp-sm-gutter-width;
$grid-padding: $bp-sm-grid-padding;
$container-width: $bp-sm-container-width;
$container-style: $bp-sm-container-style;
@include container;
}
//for medium devices
@include breakpoint($breakpoint-md) {
.grid-construct {
$total-columns: $bp-md-columns;
$grid-padding: $bp-md-grid-padding;
@include container;
}
}
// large devices
@include breakpoint($breakpoint-lg) {
.grid-construct {
$total-columns: $bp-lg-columns;
$grid-padding: $bp-lg-grid-padding;
@include container;
}
}
然后我能够编写样式,例如:
.my-style{
margin-top: 10px;
@include breakpoint($breakpoint-md) {
margin-top: 20px;
}
@include breakpoint($breakpoint-lg) {
margin-top: 40px;
}
}
我的 HTML 标记示例:
<div class="grid-construct">
<div class="my-style">
Lorem ipsum
</div>
</div>
这种模式可以移植到 Susy 2 吗?我需要$susy
为我的 3 个各自的断点制作 3 个单独的地图吗?