-
Notifications
You must be signed in to change notification settings - Fork 0
/
grid.post.css
167 lines (149 loc) · 3.55 KB
/
grid.post.css
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
Future-Grid - 2017 - Matt Hamlin - @immatthamlin / hamlim
Browser support:
IE9* - ANY browser
*( you can support IE8 if you search and replace `1rem` with your base root font-size in this file )
Future-Grid uses a flexbox fallback grid from IE9* - Edge 13 through the use of `@supports`
It uses flexbox as its primary system in browsers that support @supports and flexbox
and it uses CSS Grid for browsers the support @supports and Grid
Because it uses padding for spacing between elements to avoid `calc`, you might need to use a wrapper element
around any column of content to handle spacing properly (think background images and elements that need to set
custom padding)
Common html structure look like this:
<div class="grid grid--withGutter">
<div class="grid-item u-size3of12">
[... your component or something ]
</div>
<div class="grid-item u-size9of12">
[ ... main content maybe ]
</div>
</div>
*/
/*
The below plugins are needed to successfully compile the css below.
@use postcss-for;
@use postcss-nested;
@use postcss-cssnext;
*/
:root {
--font-size: 1rem;
--gutter: 20px;
--padding: calc(var(--gutter) / 2);
}
.Grid {
font-size: 0;
margin: 0;
padding: 0;
.Grid-item {
margin: 0;
padding: 0;
font-size: var(--font-size, 1rem);
display: inline-block;
}
&--withGutter {
padding: var(--padding, 10px);
}
&--withGutter>.Grid-item {
padding: var(--padding, 10px);
}
@supports (display: flex) {
font-size: var(--font-size, 1rem);
display: flex;
flex-direction: row;
flex-wrap: wrap;
.Grid-item {
min-height: 100%;
display: flex;
flex-direction: column;
}
}
@supports (display: grid) {
font-size: var(--font-size, 1rem);
display: grid;
grid-template-columns: repeat(12, 1fr);
&--withGutter {
grid-column-gap: var(--gutter, 20px);
grid-row-gap: var(--gutter, 20px);
}
&--withGutter > .Grid-item {
padding: 0;
}
&>.Grid-item {
display: flex;
flex-direction: column;
}
}
}
@for $size from 1 to 12 {
.u-size$(size)of12 {
width: calc( $size / 12 * 100%);
}
}
@media screen and (min-width: 640px) {
@for $size from 1 to 12 {
.u-sm-size$(size)of12 {
width: calc( $size / 12 * 100%);
}
}
}
@media screen and (min-width: 960px) {
@for $size from 1 to 12 {
.u-md-size$(size)of12 {
width: calc( $size / 12 * 100%);
}
}
}
@media screen and (min-width: 1280px) {
@for $size from 1 to 12 {
.u-lg-size$(size)of12 {
width: calc( $size / 12 * 100%);
}
}
}
@media screen and (min-width: 1440px) {
@for $size from 1 to 12 {
.u-xl-size$(size)of12 {
width: calc( $size / 12 * 100%);
}
}
}
@supports (display: grid) {
@for $size from 1 to 12 {
.u-size$(size)of12 {
width: auto;
grid-column: span $size;
}
}
@media screen and (min-width: 640px) {
@for $size from 1 to 12 {
.u-sm-size$(size)of12 {
width: auto;
grid-column: span $size;
}
}
}
@media screen and (min-width: 960px) {
@for $size from 1 to 12 {
.u-md-size$(size)of12 {
width: auto;
grid-column: span $size;
}
}
}
@media screen and (min-width: 1280px) {
@for $size from 1 to 12 {
.u-lg-size$(size)of12 {
width: auto;
grid-column: span $size;
}
}
}
@media screen and (min-width: 1440px) {
@for $size from 1 to 12 {
.u-xl-size$(size)of12 {
width: auto;
grid-column: span $size;
}
}
}
}