Omega if elements have different widths?

我的梦境 提交于 2019-12-08 10:26:29

问题


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;
    }
}

回答1:


Susy has the at-breakpoint() mixin for establishing different column-counts at different media-query breakpoints. But no, you can't do it automatically.



来源:https://stackoverflow.com/questions/14453899/omega-if-elements-have-different-widths

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!