_grid.scss 1.92 KB
Newer Older
Mark Otto's avatar
Mark Otto committed
1
2
3
4
5
6
/// Grid system
//
// Generate semantic grid columns with these mixins.

@mixin make-container($gutter: $grid-gutter-width) {
  margin-left: auto;
7
  margin-right: auto;
Mark Otto's avatar
Mark Otto committed
8
9
  padding-left:  ($gutter / 2);
  padding-right: ($gutter / 2);
vsn4ik's avatar
vsn4ik committed
10
  @if not $enable-flex {
11
12
    @include clearfix();
  }
Mark Otto's avatar
Mark Otto committed
13
14
}

15
16
17
18
19
20
21
22
23
24

// For each breakpoint, define the maximum width of the container in a media query
@mixin make-container-max-widths($max-widths: $container-max-widths) {
  @each $breakpoint, $container-max-width in $max-widths {
    @include media-breakpoint-up($breakpoint) {
      max-width: $container-max-width;
    }
  }
}

Mark Otto's avatar
Mark Otto committed
25
@mixin make-row($gutter: $grid-gutter-width) {
26
27
28
  @if $enable-flex {
    display: flex;
    flex-wrap: wrap;
29
30
  } @else {
    @include clearfix();
31
  }
Mark Otto's avatar
Mark Otto committed
32
33
34
35
36
37
  margin-left:  ($gutter / -2);
  margin-right: ($gutter / -2);
}

@mixin make-col($gutter: $grid-gutter-width) {
  position: relative;
vsn4ik's avatar
vsn4ik committed
38
  @if not $enable-flex {
39
40
    float: left;
  }
Mark Otto's avatar
Mark Otto committed
41
42
43
44
45
  min-height: 1px;
  padding-left:  ($gutter / 2);
  padding-right: ($gutter / 2);
}

Gleb Mazovetskiy's avatar
Gleb Mazovetskiy committed
46
@mixin make-col-span($size, $columns: $grid-columns) {
47
48
  @if $enable-flex {
    flex: 0 0 percentage($size / $columns);
49
    max-width: percentage($size / $columns);
50
51
52
  } @else {
    width: percentage($size / $columns);
  }
Mark Otto's avatar
Mark Otto committed
53
54
}

Gleb Mazovetskiy's avatar
Gleb Mazovetskiy committed
55
56
@mixin make-col-offset($size, $columns: $grid-columns) {
  margin-left: percentage($size / $columns);
Mark Otto's avatar
Mark Otto committed
57
58
}

Gleb Mazovetskiy's avatar
Gleb Mazovetskiy committed
59
60
@mixin make-col-push($size, $columns: $grid-columns) {
  left: if($size > 0, percentage($size / $columns), auto);
Mark Otto's avatar
Mark Otto committed
61
62
}

Gleb Mazovetskiy's avatar
Gleb Mazovetskiy committed
63
64
65
66
67
68
69
70
71
72
73
74
75
@mixin make-col-pull($size, $columns: $grid-columns) {
  right: if($size > 0, percentage($size / $columns), auto);
}

@mixin make-col-modifier($type, $size, $columns) {
  // Work around the lack of dynamic mixin @include support (https://github.com/sass/sass/issues/626)
  @if $type == push {
    @include make-col-push($size, $columns);
  } @else if $type == pull {
    @include make-col-pull($size, $columns);
  } @else if $type == offset {
    @include make-col-offset($size, $columns);
  }
Mark Otto's avatar
Mark Otto committed
76
}