Re-ordering columns with Thoughtbot Bourbon/Neat

我的梦境 提交于 2019-12-03 07:39:47

Content Priority Ordering

If you want to switch the order of display for elements in a particular view without changing the order of the content in your HTML, Neat supports convenient and intuitive negative row positioning. You can shift each column around inside its parent element as easily as this:

section {
  @include outer-container;
  aside {
    @include span-columns(3);
    @include shift(-12);
  }
  article {
    @include span-columns(9);
    @include shift(3);
  }
}

Now the article element will be on the left, and the aside will be on the right. And you can add back the mobile styles the same way as we had them before to keep your responsive display consistent:

$mobile: new-breakpoint(max-width 500px 4);

section {
  @include outer-container;
  aside {
    @include span-columns(3);
    @include shift(-12);
    @include media($mobile) {
      @include span-columns(4);
    }
  }
  article {
    @include span-columns(9);
    @include shift(3);
    @include media($mobile) {
      @include span-columns(4);
    }
  }
}

See the full article here: http://www.sitepoint.com/sass-bourbon-neat-lightweight-semantic-grids/

If you find it difficult to check the shift positions you can always go for inspect element and shift the margin percentages to geat the ideal results.

The example of drjorgepolanco doesn't work I hadn't find working solution for moving cols in Neat. IN Bootstrap Framework you can do it easily by .pull-* and .push-* classes.

My solution for Neat is

section {
  @include outer-container;
  position:relative
aside {
  @include span-columns(3);
  @include shift(9);
}
article {
  @include span-columns(9);
  position:absolute;
  }

I understand it' a hack but it works for me }

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