Bourbon/Neat:重置边距,让嵌套的div跨越整个宽度

chr*_*phe 8 grid sass css-frameworks neat bourbon

我是Bourbon/Neat的新手.我有一个关于嵌套的问题:我希望红色框填满整个宽度,它们之间没有沟槽.当对它们使用"@include omega"时,第一个框将删除其边距右边,但右边框仍然有边距,并且不调整其宽度.

你能告诉我如何让它们跨越整个父盒而它们之间没有任何边缘吗?

这是一个演示:http://wuergeengel.net.dd13736.kasserver.com/

这是我的标记:

<div class="container">
  <div class="box box-left"></div>
  <div class="box box-right">
    <div class="box-red-left nested"></div>
    <div class="box-red-right nested"></div>
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

这是我的风格:

.container
{
  @include outer-container;
}

.box
{
  border: 1px solid black;
  height: 500px;
}

.box-left
{
  @extend .box;
  @include span-columns(4);
}

.box-right
{
  @extend .box;
  @include span-columns(8);

  .nested
  {
    border: 1px solid red;
    height: 400px;


    &.box-red-left
    {
      @extend .nested;
      @include span-columns(3 of 8);
      @include omega;
    }

    &.box-red-right
    {
      @extend .nested;
      @include span-columns(5 of 8);
      @include omega;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

小智 18

或这个:

@include span-columns(5 of 8, block-collapse)
Run Code Online (Sandbox Code Playgroud)

请参阅:http: //neat.bourbon.io/docs/#span-columns


小智 9

有几种方法可以做到这一点.

  • 使用Neat的表格显示布局.例如:@include span-columns(5 of 8, table);
  • 使用Neat的底层flex-gridflex-gutter功能.例如:

    width: flex-grid(5, 8) + flex-gutter(8);
    float: left;
    
    Run Code Online (Sandbox Code Playgroud)