mirror of
https://github.com/twbs/bootstrap.git
synced 2025-01-17 09:52:29 +01:00
Merge branch 'v4' of https://github.com/twbs/derpstrap into v4
This commit is contained in:
commit
f7e103a6ac
@ -294,7 +294,7 @@ $screen-xs-max: ($screen-sm-min - .1);
|
||||
//== Grid system
|
||||
//
|
||||
//## Define your custom responsive grid.
|
||||
|
||||
$grid-breakpoints: (xs sm md lg xl);
|
||||
//** Number of columns in the grid.
|
||||
$grid-columns: 12;
|
||||
//** Padding between columns. Gets divided in half for the left and right.
|
||||
|
@ -3,79 +3,69 @@
|
||||
// Used only by Bootstrap to generate the correct number of grid classes given
|
||||
// any value of `$grid-columns`.
|
||||
|
||||
// [converter] This is defined recursively in LESS, but Sass supports real loops
|
||||
@mixin make-grid-columns($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} {
|
||||
// Common properties for all breakpoints
|
||||
@mixin make-grid-columns($columns: $grid-columns, $breakpoints: $grid-breakpoints) {
|
||||
%grid-column {
|
||||
position: relative;
|
||||
// Prevent columns from collapsing when empty
|
||||
min-height: 1px;
|
||||
// Inner gutter via padding
|
||||
padding-left: ($grid-gutter-width / 2);
|
||||
padding-left: ($grid-gutter-width / 2);
|
||||
padding-right: ($grid-gutter-width / 2);
|
||||
}
|
||||
@for $i from 1 through $columns {
|
||||
@each $breakpoint in $breakpoints {
|
||||
.col-#{$breakpoint}-#{$i} {
|
||||
@extend %grid-column;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// [converter] This is defined recursively in LESS, but Sass supports real loops
|
||||
@mixin float-grid-columns($class, $i: 1, $list: ".col-#{$class}-#{$i}") {
|
||||
@for $i from (1 + 1) through $grid-columns {
|
||||
$list: "#{$list}, .col-#{$class}-#{$i}";
|
||||
}
|
||||
#{$list} {
|
||||
// Breakpoint-specific properties
|
||||
@mixin make-grid($breakpoint, $columns: $grid-columns) {
|
||||
// Work around cross-media @extend (https://github.com/sass/sass/issues/1050)
|
||||
%grid-column-float-#{$breakpoint} {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@mixin calc-grid-column($index, $class, $type) {
|
||||
@if ($type == width) and ($index > 0) {
|
||||
.col-#{$class}-#{$index} {
|
||||
width: percentage(($index / $grid-columns));
|
||||
@for $i from 1 through $columns {
|
||||
.col-#{$breakpoint}-#{$i} {
|
||||
@extend %grid-column-float-#{$breakpoint};
|
||||
@include grid-column-width($i, $columns);
|
||||
}
|
||||
}
|
||||
@if ($type == push) and ($index > 0) {
|
||||
.col-#{$class}-push-#{$index} {
|
||||
left: percentage(($index / $grid-columns));
|
||||
}
|
||||
}
|
||||
@if ($type == push) and ($index == 0) {
|
||||
.col-#{$class}-push-0 {
|
||||
left: auto;
|
||||
}
|
||||
}
|
||||
@if ($type == pull) and ($index > 0) {
|
||||
.col-#{$class}-pull-#{$index} {
|
||||
right: percentage(($index / $grid-columns));
|
||||
}
|
||||
}
|
||||
@if ($type == pull) and ($index == 0) {
|
||||
.col-#{$class}-pull-0 {
|
||||
right: auto;
|
||||
}
|
||||
}
|
||||
@if ($type == offset) {
|
||||
.col-#{$class}-offset-#{$index} {
|
||||
margin-left: percentage(($index / $grid-columns));
|
||||
@each $modifier in (pull, push, offset) {
|
||||
@for $i from 0 through $columns {
|
||||
.col-#{$breakpoint}-#{$modifier}-#{$i} {
|
||||
@include grid-column-modifier($modifier, $i, $columns)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// [converter] This is defined recursively in LESS, but Sass supports real loops
|
||||
@mixin loop-grid-columns($columns, $class, $type) {
|
||||
@for $i from 0 through $columns {
|
||||
@include calc-grid-column($i, $class, $type);
|
||||
}
|
||||
@mixin grid-column-width($index, $columns) {
|
||||
width: percentage($index / $columns);
|
||||
}
|
||||
|
||||
@mixin grid-column-push($index, $columns) {
|
||||
left: if($index > 0, percentage($index / $columns), auto);
|
||||
}
|
||||
|
||||
// Create grid for specific class
|
||||
@mixin make-grid($class) {
|
||||
@include float-grid-columns($class);
|
||||
@include loop-grid-columns($grid-columns, $class, width);
|
||||
@include loop-grid-columns($grid-columns, $class, pull);
|
||||
@include loop-grid-columns($grid-columns, $class, push);
|
||||
@include loop-grid-columns($grid-columns, $class, offset);
|
||||
}
|
||||
@mixin grid-column-pull($index, $columns) {
|
||||
right: if($index > 0, percentage($index / $columns), auto);
|
||||
}
|
||||
|
||||
@mixin grid-column-offset($index, $columns) {
|
||||
margin-left: percentage($index / $columns);
|
||||
}
|
||||
|
||||
// Work around the lack of dynamic mixin @include support (https://github.com/sass/sass/issues/626)
|
||||
@mixin grid-column-modifier($type, $index, $columns) {
|
||||
@if $type == push {
|
||||
@include grid-column-push($index, $columns);
|
||||
} @else if $type == pull {
|
||||
@include grid-column-pull($index, $columns);
|
||||
} @else if $type == offset {
|
||||
@include grid-column-offset($index, $columns);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user