使用Bourbon Neat删除边距嵌套列

时间:2017-02-16 11:39:33

标签: html css sass bourbon neat

如何从两列中删除带有嵌套偏移列的边距。我想确保列中的内容始终居中,我似乎无法使用@include row (table); mixin来实现此功能。

codepen

html

<section>
  <div class="container">
    <div class="col">
      <div class="inner">
        centered content
      </div>
    </div>
    <div class="col">
      <div class="inner">
        centered content
      </div>
    </div>
  </div>
</section> 

SCSS

@import "bourbon";
@import "neat";

section{
  @include outer-container(100%);

  .container{
      @include span-columns(12);
      @include fill-parent;

    .col{
      @include span-columns(6);
         border: 2px solid black;

      .inner{
         @include shift-in-context(1 of 6);
         @include span-columns(8 of 12);
          background: red;

      }
    }
  }
}

2 个答案:

答案 0 :(得分:1)

你的意思是this差距?

<强> CSS

.col{
  @include span-columns(6);
     border: 2px solid black;
     margin-right: 0;
     width: 50%;

答案 1 :(得分:1)

Neat内置了一个选项。它是reset-display() mixin。在.inner课程中将其从一个表格重置为一个块,我认为您的状态良好。

section {
  @include outer-container(100%);

  .container {
    @include row(table);
    @include fill-parent;

    .col {
      @include span-columns(6);
      border: 2px solid black;

      .inner {
        @include reset-display;
        @include shift-in-context(1 of 6);
        @include span-columns(8 of 12);
        background: red;
      }
    }
  }
}