-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrid.css
367 lines (321 loc) · 7.96 KB
/
grid.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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
html {
box-sizing: border-box;
font-size: 16px;
font-family: sans-serif;
scroll-behavior: smooth;
}
*,
*::after,
*::before {
box-sizing: inherit;
}
a[href="#top"] {
margin: 1rem;
display: block;
font-size: 2rem;
text-align: center;
text-decoration: none;
}
p {
margin: 0;
}
h2 {
margin-top: 50vh;
text-align: center;
}
img {
margin: auto;
display: block;
max-width: 100%;
height: auto;
}
.menu {
margin-bottom: 100vh;
font-size: 125%;
}
.menu li {
margin-bottom: 1rem;
}
.container {
margin: 0 auto;
width: 80%;
height: 80vh;
background-color: #222;
border: medium solid #000;
}
.item {
padding: 1rem;
font-size: 1.25rem;
background-color: #666;
border: medium solid #999;
}
.sub-item {
padding: 1rem;
background-color: #ddd;
border: medium solid #ccc;
}
.grid-explicit {
display: grid;
/* Grid de 3cx3r */
grid-template-columns: 50% 100px 1fr;
grid-template-rows: 2rem 20vh 30%;
/* Grid de 5cx4r */
grid-template-columns: repeat(5, 20%);
grid-template-rows: repeat(4, auto);
grid-template-rows: repeat(4, 25%);
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(4, 1fr);
/* Grid de 4cx5r */
grid-template-columns: 20% repeat(2, 30%) 20%;
grid-template-rows: repeat(5, auto);
grid-column-gap: 2rem;
column-gap: 4rem;
grid-row-gap: 1rem;
row-gap: 2rem;
/* gap: row column */
grid-gap: 100px 0px;
gap: 1vh 1vw;
gap: 0;
}
.grid-explicit .item:nth-child(10) {
color: cyan;
grid-row-start: 2;
grid-row-end: 3;
grid-column-start: 2;
grid-column-end: 3;
grid-row: 2 / 3;
grid-column: 3 / 5;
/* grid-area: grid-row-start / grid-row-end / grid-column-start / grid-column-end; */
grid-area: 2 / 3 / 3 / 5;
}
.grid-explicit .item:nth-child(12) {
color: cyan;
grid-row: span 2;
grid-column: span 3;
}
.grid-explicit .item:nth-child(15) {
color: cyan;
grid-row: 1 / span 2;
grid-column: 1 / span 2;
}
.grid-line-names {
display: grid;
/* Grid de 3cx3r */
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
grid-template-columns: [linea-c1] 1fr [linea-c2] 1fr [linea-c3] 1fr [linea-c4];
grid-template-rows: [linea-r1] 1fr [linea-r2] 1fr [linea-r3] 1fr [linea-r4];
grid-template-rows: [linea-r1] auto [linea-r2] auto [linea-r3] auto [linea-r4];
}
.grid-line-names .item:nth-child(3) {
color: cyan;
grid-row: linea-r3 / linea-r4;
grid-column: linea-c1 / linea-c4;
/* grid-area: linea-r3 / linea-r4 / linea-c1 / linea-c4; */
}
.grid-areas {
display: grid;
/* Grid de 2cx3r */
grid-template-columns: 1fr 200px;
grid-template-rows: 100px repeat(2, 1fr) 60px;
grid-template-areas:
"header header"
"content sidebar"
"content ."
"footer footer";
}
.header {
grid-area: header;
}
.content {
grid-area: content;
}
.sidebar {
grid-area: sidebar;
}
.footer {
grid-area: footer;
}
.grid-implicit {
width: 40%;
display: grid;
display: inline-grid;
/* Grid de 4cx3r */
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(3, 200px);
}
.grid-flow {
display: grid;
/* Grid de 5cx3r */
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(3, 150px);
grid-auto-flow: row;
grid-auto-rows: 100px;
grid-auto-flow: column;
grid-auto-columns: 50px;
}
.grid-flow-dense {
display: grid;
/* Grid de 5cx4r */
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(4, 200px);
grid-auto-flow: row dense;
grid-auto-flow: column dense;
}
/* .grid-flow-dense .item:nth-child(9) {
color: cyan;
grid-row: span 3;
grid-column: span 3;
} */
.grid-flow-dense .item:nth-child(11) {
color: cyan;
grid-row: span 3;
grid-column: span 3;
}
.grid-layers {
display: grid;
/* Grid de 4cx4r */
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(4, 1fr);
}
.grid-layers .item:nth-child(1) {
background-color: #dbea33;
grid-column: 1 / 3;
grid-row: 1 / 3;
}
.grid-layers .item:nth-child(2) {
background-color: #497af8;
grid-column: 3 / 5;
grid-row: 1 / 3;
}
.grid-layers .item:nth-child(3) {
background-color: #90e971;
grid-column: 1 / 3;
grid-row: 3 / 5;
}
.grid-layers .item:nth-child(4) {
background-color: #f0952a;
grid-column: 3 / 5;
grid-row: 3 / 5;
}
.grid-layers .item:nth-child(5) {
background-color: #c92af0;
opacity: 0.75;
grid-column: 2 / 4;
grid-row: 2 / 4;
}
.grid-order {
display: grid;
/* Grid de 3cx2r */
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(2, 1fr);
}
.grid-order .item:nth-child(1) {
/* default es 0, valores negativos y positivos */
order: 1;
}
.grid-order .item:nth-child(2) {
order: 2;
}
.grid-order .item:nth-child(5) {
order: -1;
}
.grid-align {
display: grid;
/* Grid de 3cx2r */
grid-template-columns: repeat(3, 200px);
grid-template-rows: repeat(2, 200px);
/* justify-items alinea mis elementos grid en el eje horizontal (X) */
justify-items: stretch;
justify-items: start;
justify-items: end;
justify-items: center;
/* justify-items alinea mis elementos grid en el eje vertical (Y) */
align-items: stretch;
align-items: start;
align-items: end;
align-items: center;
}
.grid-align .item:nth-child(4) {
justify-self: start;
align-self: start;
}
.grid-align-tracks {
display: grid;
/* Grid de 3cx2r */
grid-template-columns: repeat(3, 200px);
grid-template-rows: repeat(2, 200px);
/* justify-content alinea los tracks de la grid en el eje horizontal (X) */
justify-content: start;
justify-content: end;
justify-content: center;
justify-content: space-between;
justify-content: space-around;
justify-content: space-evenly;
/* align-content alinea los tracks de la grid en el eje vertical (Y) */
align-content: start;
align-content: end;
align-content: center;
align-content: space-between;
align-content: space-around;
align-content: space-evenly;
}
.grid-min-max {
display: grid;
/* Grid de 4cx?r */
grid-template-columns: repeat(4, 1fr);
grid-template-columns: repeat(4, minmax(100px, 200px));
grid-template-columns: repeat(4, minmax(min-content, 200px));
grid-template-columns: repeat(4, minmax(100px, min-content));
grid-template-columns: repeat(4, minmax(100px, max-content));
grid-template-columns: repeat(4, minmax(max-content, 200px));
grid-template-columns: repeat(4, minmax(min-content, max-content));
}
.grid-repeat {
display: grid;
/* Grid de 4cx4r */
grid-template-columns: repeat(4, 10% 20% 30% 40%);
grid-template-columns: repeat(3, 10% 20% 30% 40%);
grid-template-columns: repeat(2, 10% 20% 30% 40%);
grid-template-columns: repeat(1, 10% 20% 30% 40%);
grid-template-rows: repeat(2, 100px 200px);
grid-auto-rows: 150px;
}
.grid-dynamics {
display: grid;
/* Grid de 4cx?r */
grid-template-columns: repeat(4, 100px);
/* auto-fill Rellena la grid con tracks generados dinámicamente */
grid-template-columns: repeat(auto-fill, 100px);
/* auto-fit Ajusta la grid con los tracks existentes */
grid-template-columns: repeat(auto-fit, 100px);
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}
.grid-responsive {
display: grid;
/* Grid de ?cx?r */
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.grid-nested {
display: grid;
/* Grid de 3cx?r */
grid-template-columns: repeat(3, 1fr);
}
.grid {
display: grid;
/* Grid de 3cx4r */
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(4, 1fr);
}
.subgrid {
/* Para que la característica de subgrid funcione es necesario hacer los siguiente:
1) Definir explícitamente el tamaño que ocupará el elemento que aplicará subgrid dentro del contenedor padre grid, es decir definir sus propiedades grid-column y grid-row.
2) Aplicar display grid al elemento que aplicará subgrid.
3) Aplicar el valor de subgrid a las columnas, a las filas o ambas depende de cómo se requiera */
grid-column: span 3;
grid-row: 1 / 3;
display: grid;
grid-template-columns: subgrid;
grid-template-rows: subgrid;
}