Last active
August 29, 2015 14:06
-
-
Save subhaze/ff5fb1494f044d1a17fb to your computer and use it in GitHub Desktop.
So... I had to deal with a site that was original based on 16 cols, but, ended up with a few pages that were a mixture of 16 and 12 col layouts...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Bootstrap 3 grid inception | |
@mixin new-grid($class, $columns, $grid-gutter-width: $grid-gutter-width){ | |
$i: 1; | |
$grid-columns: $columns; | |
@include make-grid-columns($i: 1, $list: ".col-#{$class}-xs-#{$i}, .col-#{$class}-sm-#{$i}, .col-#{$class}-md-#{$i}, .col-#{$class}-lg-#{$i}"); | |
@include make-grid(#{$class}-xs); | |
@media (min-width: $screen-sm-min) { | |
@include make-grid(#{$class}-sm); | |
} | |
@media (min-width: $screen-md-min) { | |
@include make-grid(#{$class}-md); | |
} | |
@media (min-width: $screen-lg-min) { | |
@include make-grid(#{$class}-lg); | |
} | |
[class*=col-#{$class}]{ | |
padding-left: $grid-gutter-width/2; | |
padding-right: $grid-gutter-width/2; | |
} | |
} | |
// Usage | |
@include new-grid('12', 12); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- | |
Markup Example | |
- Base grid was 16, but, needed 12 column | |
layouts for a couple of pages that decided to | |
have a 3 column layout... | |
---> | |
<!--- Original 16 col with 4 cols... ---> | |
<div class="row"> | |
<div class="col-md-4">col 1</div> | |
<div class="col-md-4">col 2</div> | |
<div class="col-md-4">col 3</div> | |
<div class="col-md-4">col 3</div> | |
</div> | |
<!--- New 12 col grid classes, for 3 cols... ---> | |
<div class="row"> | |
<div class="col-12-md-4">col 1</div> | |
<div class="col-12-md-4">col 2</div> | |
<div class="col-12-md-4">col 3</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment