Bourbon/Neat: Reset margin and let nested divs span the whole width
Asked Answered
R

2

8

I am new to Bourbon/Neat. I have a question concerning nesting: I want the red boxes fill the whole width, without a gutter between them. When using "@include omega" on them, the first box removes its margin-right, but the right box has still the margin and doesn't adjust its width.

Can u tell me how I can make them span the whole parent box without any margin between them?

Here's a demo: http://wuergeengel.net.dd13736.kasserver.com/

Here's my markup:

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

Here are my styles:

.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;
    }
  }
}
Rahel answered 20/2, 2014 at 22:2 Comment(0)
C
9

There are a couple ways that you can do this.

  • Use Neat's table display layout. eg: @include span-columns(5 of 8, table);
  • Use Neat's underlying flex-grid and flex-gutter functions. eg:

    width: flex-grid(5, 8) + flex-gutter(8);
    float: left;
    
Cephalalgia answered 24/2, 2014 at 15:7 Comment(0)
L
18

Or this:

@include span-columns(5 of 8, block-collapse)

See: http://neat.bourbon.io/docs/#span-columns

Laylalayman answered 8/8, 2014 at 11:6 Comment(0)
C
9

There are a couple ways that you can do this.

  • Use Neat's table display layout. eg: @include span-columns(5 of 8, table);
  • Use Neat's underlying flex-grid and flex-gutter functions. eg:

    width: flex-grid(5, 8) + flex-gutter(8);
    float: left;
    
Cephalalgia answered 24/2, 2014 at 15:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.