Last active
April 28, 2017 12:40
-
-
Save Conrad777/5c0f8d9a51264d7f8e53 to your computer and use it in GitHub Desktop.
Twitter Bootstrap grid: Replace floats with inline-block display and add utility classes (.vertical-align-top, .vertical-align-bottom, .vertical-align-middle) for vertical alignment. Import file after Bootstrap imports.
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
// replace floats with inline-block | |
%set-inline-block { | |
float: none; | |
display: inline-block; | |
margin: 0 -0.125em; | |
vertical-align: top; | |
} | |
@mixin replaceFloatloop($class) { | |
@for $i from 1 through 12 { | |
.col-#{$class}-#{$i} { @extend %set-inline-block; } | |
} | |
} | |
@each $size in xs, sm, md, lg { | |
@include replaceFloatloop($size); | |
} | |
// vertical align utility classes | |
@mixin addVerticalAlign($pos) { | |
.vertical-align-#{$pos} { vertical-align: $pos } | |
} | |
@each $pos in top, middle, bottom { | |
@include addVerticalAlign($pos); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment