Skip to content

Instantly share code, notes, and snippets.

@nateroling
Created December 15, 2014 20:50
Show Gist options
  • Save nateroling/8a1829a7f885cfa8bd7b to your computer and use it in GitHub Desktop.
Save nateroling/8a1829a7f885cfa8bd7b to your computer and use it in GitHub Desktop.
Bootstrap Grid Child Columns
//
// Bootstrap Grid Child Columns
// See: http://nateroling.com/2014/11/25/aligning-nested-grids/
// --------------------------------------------------
.make-xs-child-column(@columns; @parent-columns; @gutter: @grid-gutter-width) {
.make-sm-column(@columns, @gutter);
width: percentage((@columns / @parent-columns));
}
.make-xs-child-column-offset(@columns; @parent-columns) {
margin-left: percentage((@columns / @parent-columns));
}
.make-xs-child-column-push(@columns; @parent-columns) {
left: percentage((@columns / @parent-columns));
}
.make-xs-child-column-pull(@columns; @parent-columns) {
right: percentage((@columns / @parent-columns));
}
.make-sm-child-column(@columns; @parent-columns; @gutter: @grid-gutter-width) {
.make-sm-column(@columns, @gutter);
@media (min-width: @screen-sm-min) {
width: percentage((@columns / @parent-columns));
}
}
.make-sm-child-column-offset(@columns; @parent-columns) {
@media (min-width: @screen-sm-min) {
margin-left: percentage((@columns / @parent-columns));
}
}
.make-sm-child-column-push(@columns; @parent-columns) {
@media (min-width: @screen-sm-min) {
left: percentage((@columns / @parent-columns));
}
}
.make-sm-child-column-pull(@columns; @parent-columns) {
@media (min-width: @screen-sm-min) {
right: percentage((@columns / @parent-columns));
}
}
.make-md-child-column(@columns; @parent-columns; @gutter: @grid-gutter-width) {
.make-md-column(@columns, @gutter);
@media (min-width: @screen-md-min) {
width: percentage((@columns / @parent-columns));
}
}
.make-md-child-column-offset(@columns; @parent-columns) {
@media (min-width: @screen-md-min) {
margin-left: percentage((@columns / @parent-columns));
}
}
.make-md-child-column-push(@columns; @parent-columns) {
@media (min-width: @screen-md-min) {
left: percentage((@columns / @parent-columns));
}
}
.make-md-child-column-pull(@columns; @parent-columns) {
@media (min-width: @screen-md-min) {
right: percentage((@columns / @parent-columns));
}
}
.make-lg-child-column(@columns; @parent-columns; @gutter: @grid-gutter-width) {
.make-lg-column(@columns, @gutter);
@media (min-width: @screen-lg-min) {
width: percentage((@columns / @parent-columns));
}
}
.make-lg-child-column-offset(@columns; @parent-columns) {
@media (min-width: @screen-lg-min) {
margin-left: percentage((@columns / @parent-columns));
}
}
.make-lg-child-column-push(@columns; @parent-columns) {
@media (min-width: @screen-lg-min) {
left: percentage((@columns / @parent-columns));
}
}
.make-lg-child-column-pull(@columns; @parent-columns) {
@media (min-width: @screen-lg-min) {
right: percentage((@columns / @parent-columns));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment