-
Notifications
You must be signed in to change notification settings - Fork 11
/
grid.html
164 lines (152 loc) · 7.23 KB
/
grid.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>grid: shorthand; // CSS example</title>
<link rel="stylesheet" href="css-example.css">
<style id="base">.container {
display: grid;
padding: 8px;
gap: 8px;
border: 8px solid silver;
}
.item {
padding: 8px;
background: coral;
}
</style>
</head>
<body>
<h1 class="h1">grid:<br> shorthand;</h1>
<details class="details">
<summary class="summary">Syntax details:</summary>
<dl class="spec">
<dt class="spec__term">Name:</dt>
<dd class="spec__def">grid</dd>
<dt class="spec__term">Value:</dt>
<dd class="spec__def"><'grid-template'><br> |<br> <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>?<br> |<br> [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'></dd>
<dt class="spec__term">Initial:</dt>
<dd class="spec__def"><strong class="initial">none</strong></dd>
<dt class="spec__term">Applies to:</dt>
<dd class="spec__def">grid containers</dd>
</dl>
<dl class="spec">
<dt class="spec__term">Name:</dt>
<dd class="spec__def">grid-template</dd>
<dt class="spec__term">Value:</dt>
<dd class="spec__def">none<br> |<br> [ <'grid-template-rows'> / <'grid-template-columns'> ]</dd>
<dt class="spec__term">Initial:</dt>
<dd class="spec__def"><strong class="initial">none</strong></dd>
<dt class="spec__term">Applies to:</dt>
<dd class="spec__def">grid containers</dd>
</dl>
<dl class="spec">
<dt class="spec__term">Name:</dt>
<dd class="spec__def">grid-template-columns, grid-template-rows</dd>
<dt class="spec__term">Value:</dt>
<dd class="spec__def">none | <track-list> | <auto-track-list></dd>
<dt class="spec__term">Initial:</dt>
<dd class="spec__def"><strong class="initial">none</strong></dd>
<dt class="spec__term">Applies to:</dt>
<dd class="spec__def">grid containers</dd>
</dl>
<dl class="spec">
<dt class="spec__term">Name:</dt>
<dd class="spec__def">grid-auto-flow</dd>
<dt class="spec__term">Value:</dt>
<dd class="spec__def">[ row | column ] || dense</dd>
<dt class="spec__term">Initial:</dt>
<dd class="spec__def"><strong class="initial">row</strong></dd>
<dt class="spec__term">Applies to:</dt>
<dd class="spec__def">grid containers</dd>
</dl>
<dl class="spec">
<dt class="spec__term">Name:</dt>
<dd class="spec__def">grid-auto-columns, grid-auto-rows</dd>
<dt class="spec__term">Value:</dt>
<dd class="spec__def"><track-size>+</dd>
<dt class="spec__term">Initial:</dt>
<dd class="spec__def"><strong class="initial">auto</strong></dd>
<dt class="spec__term">Applies to:</dt>
<dd class="spec__def">grid containers</dd>
</dl>
<p class="p">(&&): All of which must occur, in any order.</p>
<p class="p">(||): One or more of them must occur, in any order.</p>
<p class="p">(|): Exactly one of them must occur.</p>
<p class="p">(+): Occurs one or more times.</p>
<p class="p">(?): Occurs zero or one times.</p>
</details>
<hr class="hr">
<section id="try" class="section">
<h2 class="h2">Applies to: <mark id="applies" class="mark">#container</mark></h2>
<ul class="list">
<li class="list__item">
<input class="list__input" type="radio" name="grid" id="none" checked>
<label class="list__label" for="none">grid: none; <sup class="sup">/* Initial value */</sup></label>
</li>
</ul>
<fieldset class="fieldset">
<legend class="legend"><'grid-template-rows'> / <'grid-template-columns'></legend>
<ul class="list">
<li class="list__item">
<input class="list__input" type="radio" name="grid" id="auto-and-311">
<label class="list__label" for="auto-and-311">grid: auto / 3fr 1fr 1fr</label>
</li>
<li class="list__item">
<input class="list__input" type="radio" name="grid" id="311-and-auto">
<label class="list__label" for="311-and-auto">grid: 3fr 1fr 1fr / auto;</label>
</li>
</ul>
</fieldset>
<fieldset class="fieldset">
<legend class="legend"><'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>?</legend>
<ul class="list">
<li class="list__item">
<input class="list__input" type="radio" name="grid" id="11-and-autoflow-311">
<label class="list__label" for="11-and-autoflow-311">grid: 1fr 1fr / auto-flow 3fr 1fr 1fr;</label>
</li>
</ul>
</fieldset>
<fieldset class="fieldset">
<legend class="legend">[ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'></legend>
<ul class="list">
<li class="list__item">
<input class="list__input" type="radio" name="grid" id="autoflow-311-and-11">
<label class="list__label" for="autoflow-311-and-11">grid: auto-flow 3fr 1fr 1fr / 1fr 1fr;</label>
</li>
</ul>
</fieldset>
</section>
<hr class="hr">
<section class="section">
<h2 class="h2"><mark class="mark"><output id="selector" class="selector"></output> <output id="declaration" class="declaration"></output></mark></h2>
<div class="demo">
🌼
<div id="container" class="container">
<div class="item item--1">1️⃣</div>
<div class="item item--2">2️⃣ 2️⃣</div>
<div class="item item--3">3️⃣ 3️⃣ 3️⃣</div>
<div class="item item--4">4️⃣ 4️⃣ 4️⃣ 4️⃣</div>
<div class="item item--5">5️⃣ 5️⃣ 5️⃣ 5️⃣ 5️⃣</div>
</div>
🌼
</div>
<details class="details">
<summary class="summary">Base code:</summary>
<pre class="pre"><code id="base-output" class="code code--block code--base"></code></pre>
</details>
</section>
<hr class="hr">
<section class="section">
<h2 class="h2">Equivalent to:</h2>
<pre class="pre"><code id="equivalent-to" class="code code--block code--eq" data-eq="== grid-template-rows grid-template-columns grid-template-areas grid-auto-flow grid-auto-rows grid-auto-columns"></code></pre>
</section>
<hr class="hr">
<p class="p">
<a class="link" href="https://www.w3.org/TR/css-grid-1/#grid-shorthand">https://www.w3.org/TR/css-grid-1/#grid-shorthand</a>
</p>
<script src="css-example.js"></script>
</body>
</html>