Created
June 6, 2016 19:38
-
-
Save jserrao/299d9e2df80545b545753fec1f702b8e to your computer and use it in GitHub Desktop.
Bootstrap grid extension adds 5th breakpoint for super small devices (iPhone SE)
This file contains hidden or 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
// Extending bootstrap grid concept for an extra smaller breakpoint via mixin | |
// Set small breakpoints (default xs is 480px) | |
$screen-xxs-min: 380px; | |
$screen-xs-min: 480px; | |
// Generate the super columns (xxs extension) | |
@mixin make-xxs-column($columns, $gutter: $grid-gutter-width) { | |
position: relative; | |
float: left; | |
width: percentage(($columns / $grid-columns)); | |
min-height: 1px; | |
padding-left: ($gutter / 2); | |
padding-right: ($gutter / 2); | |
} | |
@mixin make-xxs-column-offset($columns) { | |
margin-left: percentage(($columns / $grid-columns)); | |
} | |
@mixin make-xxs-column-push($columns) { | |
left: percentage(($columns / $grid-columns)); | |
} | |
@mixin make-xxs-column-pull($columns) { | |
right: percentage(($columns / $grid-columns)); | |
} | |
// Overwrite existing bootstrap grid xs to function with xxs | |
// We're basically telling the grid system to add a min-width break- | |
// -for what was the smallest bootstrap break (480px) | |
@mixin make-xs-column($columns, $gutter: $grid-gutter-width) { | |
position: relative; | |
min-height: 1px; | |
padding-left: ($gutter / 2); | |
padding-right: ($gutter / 2); | |
@media (min-width: $screen-xs-min) { | |
float: left; | |
width: percentage(($columns / $grid-columns)); | |
} | |
} | |
@mixin make-xs-column-offset($columns) { | |
@media (min-width: $screen-xs-min) { | |
margin-left: percentage(($columns / $grid-columns)); | |
} | |
} | |
@mixin make-xs-column-push($columns) { | |
@media (min-width: $screen-xs-min) { | |
left: percentage(($columns / $grid-columns)); | |
} | |
} | |
@mixin make-xs-column-pull($columns) { | |
@media (min-width: $screen-xs-min) { | |
right: percentage(($columns / $grid-columns)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment