Skip to content

Instantly share code, notes, and snippets.

@T1T4N
Created March 11, 2016 14:22
Show Gist options
  • Save T1T4N/c9e44512551a68b7b3e0 to your computer and use it in GitHub Desktop.
Save T1T4N/c9e44512551a68b7b3e0 to your computer and use it in GitHub Desktop.
A SASS stylesheet that adds a xl-column to the bootstrap grid system
@import "bootstrap";
// XLarge screen / wide desktop
//** Deprecated `$screen-xl` as of v3.0.1
$screen-xl: 1600px !default;
$screen-xl-min: $screen-xl !default;
$screen-xl-desktop: $screen-xl-min !default;
// So media queries don't overlap when required, provide a maximum
$screen-lg-max: ($screen-xl-min - 1) !default;
//== Container sizes
// XLarge screen / wide desktop
$container-xlarge-desktop: (1540px + $grid-gutter-width) !default;
//** For `$screen-xl-min` and up.
$container-xl: $container-xlarge-desktop !default;
// Container widths
// Set the container width, and override it for fixed navbars in media queries.
.container {
@media (min-width: $screen-xl-min) {
width: $container-xl;
}
}
@mixin make-grid-xlcolumns($i: 1, $list: ".col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}, .col-xl-#{$i}") {
@for $i from (1 + 1) through $grid-columns {
$list: "#{$list}, .col-xs-#{$i}, .col-sm-#{$i}, .col-md-#{$i}, .col-lg-#{$i}, .col-xl-#{$i}";
}
#{$list} {
position: relative;
// Prevent columns from collapsing when empty
min-height: 1px;
// Inner gutter via padding
padding-left: ceil(($grid-gutter-width / 2));
padding-right: floor(($grid-gutter-width / 2));
}
}
@include make-grid-xlcolumns;
@media (min-width: $screen-xl-min) {
@include make-grid(xl);
}
// Generate the large columns
@mixin make-xl-column($columns, $gutter: $grid-gutter-width) {
position: relative;
min-height: 1px;
padding-left: ($gutter / 2);
padding-right: ($gutter / 2);
@media (min-width: $screen-xl-min) {
float: left;
width: percentage(($columns / $grid-columns));
}
}
@mixin make-xl-column-offset($columns) {
@media (min-width: $screen-xl-min) {
margin-left: percentage(($columns / $grid-columns));
}
}
@mixin make-xl-column-push($columns) {
@media (min-width: $screen-xl-min) {
left: percentage(($columns / $grid-columns));
}
}
@mixin make-xl-column-pull($columns) {
@media (min-width: $screen-xl-min) {
right: percentage(($columns / $grid-columns));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment