-
Notifications
You must be signed in to change notification settings - Fork 844
/
Copy pathgrid-wrapper.html
146 lines (123 loc) · 3.15 KB
/
grid-wrapper.html
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>CSS Cookbook: Grid Wrapper</title>
<link rel="stylesheet" href="styles.css" />
<style>
.grid {
display: grid;
grid-template-columns: minmax(20px, 1fr) repeat(6, minmax(0, 60px)) minmax(
20px,
1fr
);
grid-auto-rows: minmax(100px, auto);
grid-gap: 10px;
}
.grid > * {
border: 2px solid rgb(95 97 110);
border-radius: 0.5em;
padding: 20px;
}
.full-width {
grid-column: 1 / -1;
}
.wrapper {
grid-column: 2 / -2;
}
.left-edge {
grid-column: 1 / -2;
}
.right-wrapper {
grid-column: 4 / -2;
}
</style>
<style class="editable">
.grid {
display: grid;
grid-template-columns: minmax(20px, 1fr) repeat(6, minmax(0, 60px)) minmax(
20px,
1fr
);
grid-gap: 10px;
}
.full-width {
grid-column: 1 / -1;
}
.wrapper {
grid-column: 2 / -2;
}
.left-edge {
grid-column: 1 / -2;
}
.right-wrapper {
grid-column: 4 / -2;
}
</style>
</head>
<body>
<section class="preview">
<div class="grid">
<div class="wrapper">
<p>
This item aligns to a central “wrapper” – columns that have a
maximum width.
</p>
</div>
<div class="full-width">
<p>This item aligns to the edge of the grid container.</p>
</div>
<div class="left-edge">
<p>
This item aligns to the left edge of the grid container and the
right edge of the wrapper.
</p>
</div>
<div class="right-wrapper">
<p>This item aligns to the right edge of the “wrapper” columns.</p>
</div>
</div>
</section>
<textarea class="playable playable-css" style="height: 170px">
.grid {
display: grid;
grid-template-columns: minmax(20px, 1fr) repeat(6, minmax(0, 60px)) minmax(20px, 1fr);
grid-gap: 10px;
}
.full-width {
grid-column: 1 / -1;
}
.wrapper {
grid-column: 2 / -2;
}
.left-edge {
grid-column: 1 / -2;
}
.right-wrapper {
grid-column: 4 / -2;
}</textarea
>
<textarea class="playable playable-html" style="height: 170px">
<div class="grid">
<div class="wrapper">
<p>This item aligns to a central “wrapper” – columns that have a maximum width.</p>
</div>
<div class="full-width">
<p>This item aligns to the edge of the grid container.</p>
</div>
<div class="left-edge">
<p>This item aligns to the left edge of the grid container and the right edge of the wrapper.</p>
</div>
<div class="right-wrapper">
<p>This item aligns to the right edge of the “wrapper” columns.</p>
</div>
</div></textarea
>
<!-- leave everything below here alone -->
<div class="playable-buttons">
<input id="reset" type="button" value="Reset" />
</div>
</body>
<script src="playable.js"></script>
</html>