【问题标题】:singularity gs remove the left/right margins奇点 gs 删除左右边距
【发布时间】:2013-07-24 07:37:19
【问题描述】:

我是第一次使用singularitygs。我想知道如何删除左右边距(排水沟)?就像 960gs 中的 alpha/omega 选项一样。有这样的吗?

谢谢。我知道$位置。 我没有正确描述我的问题

所以下面的场景:

<article>
    <div class="teaser"></div>
    <div class="teaser"></div>
    <div class="teaser"></div>
    <div class="teaser"></div>
</article>
<sidebar></sidebar>

$grids: 12;
$gutters: .2;

article {
    @include grid-span(8);
}
sidebar {
    @include grid-span(4, 9);
}
.teaser { 
    @include float-span(4, 1, 8);
    &:nth-child(odd) {
        // here i want to remove the right-margin - because otherwise the containers are not floating. dirty way would be: margin-right: 0 !important;
    }
}

【问题讨论】:

    标签: singularitygs


    【解决方案1】:

    Singularity 有一个位置变量作为第二个参数。 @include grid-span($width, $location);如果 $location 是网格的第一列,您可以将其更改为 1,如果它是 12 列网格的最后一列,则可以更改为 12。

    默认情况下,Singularity 使用写入网格的isolation method,因此这个位置值对于在网格上移动东西很重要。你可以通过写$output: float;来切换到更传统的花车

    【讨论】:

    • 另外,如果您习惯使用浮点输出方法(如 960 使用的)并且使用对称网格(多个相同大小的列),您可以使用float-span,这将允许你只传递你想要跨越的列数,加上第一个/最后一个为行中的第一个/行中的最后一个
    【解决方案2】:

    实际上有一个选项可以设置排水沟,即add-gutter(x);

    例如:

    .sidebar {
      @include add-gutter(0);
      @include grid-span(2, 1);
    }
    
    .main {
      @include add-gutter(0);
      @include grid-span(10, 3);
    }
    

    来自文档:https://github.com/at-import/Singularity/wiki/Creating-Grids#gutter-styles

    【讨论】: