如果元素有,Susy会自动填充多列布局 宽度不同?
我想要什么(见下面的代码):
+---------+---------+---------+
| I | want | this |
+---------+---------+---------+
| filled | automatically! |
+---------+-------------------+
我得到(见下面的代码):
+---------+---------+---------+
| I | want | |
+---------+---------+---------+
| this | filled | |
+---------+---------+---------+
| automatically! | |
+---------+---------+---------+
目的?对于响应式布局,应该可以切换到两个 较小屏幕的列(媒体查询断点):
+---------+---------+
| I | want |
+---------+---------+
| this | filled |
+---------+---------+
| automatically! |
+-------------------+
这可以通过让所有元素向左浮动来实现。 但是,我想使用像Susy这样的东西来降低复杂性。
HTML:
<div id="container">
<div class="one">I</div>
<div class="one">want</div>
<div class="one">this</div>
<div class="one">filled</div>
<div class="two">automatically</div>
</div>
SCSS,没有Omega但没有工作:
@import 'susy';
$total-columns: 3;
$column-width: 200px;
$gutter-width: 5px;
$grid-padding: 10px;
#container {
@include container;
@include susy-grid-background;
&>div {
height: 50px;
}
&>div.one {
@include span-columns(1);
}
&>div.two {
@include span-columns(2);
background: yellow;
}
}
答案 0 :(得分:1)
Susy拥有at-breakpoint()
mixin,用于在不同的媒体查询断点处建立不同的列数。但不,你不能自动。