_grid.scss 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. .container {
  2. margin: 0 auto;
  3. max-width: 1280px;
  4. width: 90%;
  5. }
  6. @media #{$medium-and-up} {
  7. .container {
  8. width: 85%;
  9. }
  10. }
  11. @media #{$large-and-up} {
  12. .container {
  13. width: 70%;
  14. }
  15. }
  16. .col .row {
  17. margin-left: (-1 * $gutter-width / 2);
  18. margin-right: (-1 * $gutter-width / 2);
  19. }
  20. .section {
  21. padding-top: 1rem;
  22. padding-bottom: 1rem;
  23. &.no-pad {
  24. padding: 0;
  25. }
  26. &.no-pad-bot {
  27. padding-bottom: 0;
  28. }
  29. &.no-pad-top {
  30. padding-top: 0;
  31. }
  32. }
  33. // Mixins to eliminate code repitition
  34. @mixin reset-offset {
  35. margin-left: auto;
  36. left: auto;
  37. right: auto;
  38. }
  39. @mixin grid-classes($size, $i, $perc) {
  40. &.offset-#{$size}#{$i} {
  41. margin-left: $perc;
  42. }
  43. &.pull-#{$size}#{$i} {
  44. right: $perc;
  45. }
  46. &.push-#{$size}#{$i} {
  47. left: $perc;
  48. }
  49. }
  50. .row {
  51. margin-left: auto;
  52. margin-right: auto;
  53. margin-bottom: 20px;
  54. // Clear floating children
  55. &:after {
  56. content: "";
  57. display: table;
  58. clear: both;
  59. }
  60. .col {
  61. float: left;
  62. box-sizing: border-box;
  63. padding: 0 $gutter-width / 2;
  64. min-height: 1px;
  65. &[class*="push-"],
  66. &[class*="pull-"] {
  67. position: relative;
  68. }
  69. $i: 1;
  70. @while $i <= $num-cols {
  71. $perc: unquote((100 / ($num-cols / $i)) + "%");
  72. &.s#{$i} {
  73. width: $perc;
  74. @include reset-offset;
  75. }
  76. $i: $i + 1;
  77. }
  78. $i: 1;
  79. @while $i <= $num-cols {
  80. $perc: unquote((100 / ($num-cols / $i)) + "%");
  81. @include grid-classes("s", $i, $perc);
  82. $i: $i + 1;
  83. }
  84. @media #{$medium-and-up} {
  85. $i: 1;
  86. @while $i <= $num-cols {
  87. $perc: unquote((100 / ($num-cols / $i)) + "%");
  88. &.m#{$i} {
  89. width: $perc;
  90. @include reset-offset;
  91. }
  92. $i: $i + 1
  93. }
  94. $i: 1;
  95. @while $i <= $num-cols {
  96. $perc: unquote((100 / ($num-cols / $i)) + "%");
  97. @include grid-classes("m", $i, $perc);
  98. $i: $i + 1;
  99. }
  100. }
  101. @media #{$large-and-up} {
  102. $i: 1;
  103. @while $i <= $num-cols {
  104. $perc: unquote((100 / ($num-cols / $i)) + "%");
  105. &.l#{$i} {
  106. width: $perc;
  107. @include reset-offset;
  108. }
  109. $i: $i + 1;
  110. }
  111. $i: 1;
  112. @while $i <= $num-cols {
  113. $perc: unquote((100 / ($num-cols / $i)) + "%");
  114. @include grid-classes("l", $i, $perc);
  115. $i: $i + 1;
  116. }
  117. }
  118. @media #{$extra-large-and-up} {
  119. $i: 1;
  120. @while $i <= $num-cols {
  121. $perc: unquote((100 / ($num-cols / $i)) + "%");
  122. &.xl#{$i} {
  123. width: $perc;
  124. @include reset-offset;
  125. }
  126. $i: $i + 1;
  127. }
  128. $i: 1;
  129. @while $i <= $num-cols {
  130. $perc: unquote((100 / ($num-cols / $i)) + "%");
  131. @include grid-classes("xl", $i, $perc);
  132. $i: $i + 1;
  133. }
  134. }
  135. }
  136. }