Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Conrad777
Last active April 28, 2017 12:40
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Conrad777/5c0f8d9a51264d7f8e53 to your computer and use it in GitHub Desktop.
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.
// 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