Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set fixed gutter in Bourbon Neat

Tags:

sass

bourbon

neat

By default, Neat uses percentages as the margin-right of each span-columns element, but I'm hoping for a fixed 30px gutter, regardless of the outer-container width.

enter image description here

like image 648
matthoiland Avatar asked Feb 18 '15 23:02

matthoiland


1 Answers

One solution would be to create your own mixin that overrides the Neat gutter.

@mixin col-with-gutter( $cols, $gutter ){
    @include span-columns($cols);
    margin-right: $gutter;
}

.half{
    @include col-with-gutter(2, 30px);
}

Obviously you would have to do some additional customization if you need to use some of the other span-columns features. I suggest you look at the _span-columns.scss source to figure out what might work best for you.

Honestly though, I think there is a reason that this functionality isn't built in. In most situations, setting the gutter to 30px would be detrimental to a responsive design (since the total width of the columns will likely not add up to 100%).

You may have a legitimate reason for wanting exactly 30px, but if you are not certain you need an exact value it may be worthwhile to reconsider.

like image 106
twiz Avatar answered Oct 29 '22 03:10

twiz