Created
September 2, 2015 20:30
-
-
Save gearsdigital/1c06703a85445401dd55 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
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
// ---- | |
// libsass (v3.2.5) | |
// ---- | |
// all credits to bootstrap | |
// | |
// | |
// I want to generate something like this: | |
// http://sassmeister.com/gist/1d3659803d5833e75709 | |
// | |
// | |
$grid-columns: 12; | |
@mixin float-grid-columns($class, $i: 1, $list: ".col-#{$class}-#{$i}") { | |
@for $i from (1 + 1) through $grid-columns { | |
$list: "#{$list}, .col-#{$class}-#{$i}"; | |
} | |
#{$list} { | |
float: left; | |
} | |
} | |
@mixin calc-grid-column($index, $class, $type) { | |
@if ($type == width) and ($index > 0) { | |
.col-#{$class}-#{$index} { | |
width: percentage(($index / $grid-columns)); | |
} | |
} | |
} | |
@mixin loop-grid-columns($columns, $class, $type) { | |
@for $i from 0 through $columns { | |
@include calc-grid-column($i, $class, $type); | |
} | |
} | |
@mixin make-grid($class) { | |
@include float-grid-columns($class); | |
@include loop-grid-columns($grid-columns, $class, width); | |
} | |
@include make-grid(xs); |
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
.col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 { | |
float: left; | |
} | |
.col-xs-1 { | |
width: 8.33333%; | |
} | |
.col-xs-2 { | |
width: 16.66667%; | |
} | |
.col-xs-3 { | |
width: 25%; | |
} | |
.col-xs-4 { | |
width: 33.33333%; | |
} | |
.col-xs-5 { | |
width: 41.66667%; | |
} | |
.col-xs-6 { | |
width: 50%; | |
} | |
.col-xs-7 { | |
width: 58.33333%; | |
} | |
.col-xs-8 { | |
width: 66.66667%; | |
} | |
.col-xs-9 { | |
width: 75%; | |
} | |
.col-xs-10 { | |
width: 83.33333%; | |
} | |
.col-xs-11 { | |
width: 91.66667%; | |
} | |
.col-xs-12 { | |
width: 100%; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment