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