我正在尝试为网格定义一些默认行为,然后在特定断点处覆盖它们。在下面的示例中,我希望两个 div 堆叠在一起,稍微修改默认的装订线设置,然后在 800px 及以上我希望 div 彼此相邻堆叠。第二部分不会发生。似乎将小于 800 像素场景的一些边距设置应用于大于 800 像素的场景。请让我知道如何编写代码并遵守 susy 最佳实践。
HTML:
<div class="container">
<div class="primary">
<p>I am Primary</p>
</div>
<div class="secondary">
<p>I am Secondary</p>
</div>
</div>
SCSS:
$susy:
(
flow: ltr,
output: float,
math: fluid,
column-width: false,
container: 1200px,
container-position: center,
last-flow: to, columns: 12,
gutters: 1 / 4,
gutter-position: after,
global-box-sizing: border-box,
debug: (
image: hide,
color: rgba(#66f, 0.25),
spot: background, toggle: bottom right)
);
* {
@include box-sizing(border-box);
}
.container{
@include container;
}
.primary{
background-color: red;
}
.secondary{
background-color: blue;
}
// Mobile first layout with slightly different
// gutter settings from default
@include with-layout(12 0.5 split){
.primary{
@include span(12);
}
.secondary{
@include span(12);
}
}
// this layout should take over at 800px and above
// and share a row but instead boxes end up on different
// rows
@include susy-breakpoint(800px, $susy)
{
.primary{
@include span(first 6);
}
.secondary{
@include span(last 6);
}
}
我还制作了一个 codepen 示例,可以在这里找到: