This repository was archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_grid-layout.scss
More file actions
73 lines (56 loc) · 1.41 KB
/
_grid-layout.scss
File metadata and controls
73 lines (56 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@mixin grid-layout ($columns: 24, $sitewidth: 960px, $margin: 20px) {
$col-margin: percentage($margin/$sitewidth);
// remove unit for css linting
@if $margin == 0 {
$col-margin: 0;
}
.cols#{$columns} {
margin: 0;
&:after {
clear: both;
content: " ";
display: block;
font-size: 0;
visibility: hidden;
}
> .col {
float: left;
margin-left: $col-margin;
min-height: 1px;
&:first-child {
margin-left: 0;
}
}
&.right-to-left > .col {
float: right;
margin-left: 0;
margin-right: $col-margin;
&:first-child {
margin-right: 0;
}
}
}
$i: $columns;
@while $i > 0 {
$width: (100% / $columns) * $i;
$margin: ($col-margin / $columns) * $i;
.cols#{$columns} > .c#{$i}of#{$columns} {
width: $width + $margin - $col-margin;
}
.cols#{$columns} > .col.offset#{$i}of#{$columns} {
margin-left: $width + $margin + $col-margin;
}
.cols#{$columns} > .col.offset#{$i}of#{$columns}:first-child {
margin-left: $width + $margin;
}
.cols#{$columns}.right-to-left > .col.offset#{$i}of#{$columns} {
margin-left: 0;
margin-right: $width + $margin + $col-margin;
}
.cols#{$columns}.right-to-left > .col.offset#{$i}of#{$columns}:first-child {
margin-left: 0;
margin-right: $width + $margin;
}
$i: $i - 1;
}
}