1 // html-grid.scss v1.0 | @ajlkn | MIT licensed */
5 /// Initializes the current element as an HTML grid.
6 /// @param {mixed} $gutters Gutters (either a single number to set both column/row gutters, or a list to set them individually).
7 /// @param {mixed} $suffix Column class suffix (optional; either a single suffix or a list).
8 @mixin html-grid($gutters: 1.5em, $suffix: '') {
12 $multipliers: 0, 0.25, 0.5, 1, 1.50, 2.00;
18 @if (type-of($suffix) == 'list') {
29 @if (type-of($gutters) == 'list') {
31 $guttersCols: nth($gutters, 1);
32 $guttersRows: nth($gutters, 2);
37 $guttersCols: $gutters;
45 box-sizing: border-box;
50 box-sizing: border-box;
64 justify-content: flex-start;
68 justify-content: center;
72 justify-content: flex-end;
76 align-items: flex-start;
84 align-items: flex-end;
87 // Step through suffixes.
88 @each $suffix in $suffixes {
92 $suffix: '-' + $suffix;
106 @for $i from 1 through $cols {
107 > .col-#{$i}#{$suffix} {
111 > .off-#{$i}#{$suffix} {
112 margin-left: $unit * $i;
116 // Step through multipliers.
117 @each $multiplier in $multipliers {
122 @if ($multiplier != 1) {
123 $class: '.gtr-' + ($multiplier * 100);
127 margin-top: ($guttersRows * $multiplier * -1);
128 margin-left: ($guttersCols * $multiplier * -1);
131 padding: ($guttersRows * $multiplier) 0 0 ($guttersCols * $multiplier);
136 margin-top: $guttersCols * $multiplier * -1;
139 padding-top: $guttersCols * $multiplier;