Can Susy automatically fill a multi column layout if elements have different widths?
What I want (see code below):
+---------+---------+---------+
| I | want | this |
+---------+---------+---------+
| filled | automatically! |
+---------+-------------------+
What I get (see code below):
+---------+---------+---------+
| I | want | |
+---------+---------+---------+
| this | filled | |
+---------+---------+---------+
| automatically! | |
+---------+---------+---------+
Purpose? For a responsive layout, it should be possible to switch to two columns for smaller screens (media query breakpoint):
+---------+---------+
| I | want |
+---------+---------+
| this | filled |
+---------+---------+
| automatically! |
+-------------------+
This can be implemented simply by letting all elements float left. However, I would like to use something like Susy to reduce complexity.
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, without Omega and not working:
@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;
}
}
Susy has the
at-breakpoint()
mixin for establishing different column-counts at different media-query breakpoints. But no, you can't do it automatically.