-
Notifications
You must be signed in to change notification settings - Fork 0
/
tables.html
305 lines (295 loc) · 9.07 KB
/
tables.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
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
<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1">
<title>Responsive Tables</title>
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:300,400,500,700,300italic,400italic,500italic,700italic|Source+Sans+Pro:200,300,400,600,700,900,200italic,300italic,400italic,600italic,700italic,900italic|Source+Code+Pro:300,400,500,600,700,900" rel=stylesheet>
<link href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/67439/basic.css" rel=stylesheet data-populated=true>
<link href="https://s3-us-west-2.amazonaws.com/s.cdpn.io/67439/data-buttons.css" rel=stylesheet data-populated=true>
<style>
html,
body {
background: #eee;
}
[data-table] {
font-size: 12pt;
width: 100%;
font-family: 'Source Sans Pro', sans-serif;
margin: 1em 0;
color: #333;
border-collapse: collapse;
}
[data-table] thead th,
[data-table] tfoot th {
color: #777;
background: rgba(0,0,0,.1);
}
[data-table] caption {
padding: .5em;
}
[data-table] th,
[data-table] td {
padding: .5em;
background: white;
border: 1px solid #aaa;
}
[data-table] tbody tr:nth-of-type(even) {
background: rgba(0,0,0,.05);
}
</style>
<h1>Responsive Table Layouts</h1>
<h2>Grid Layout using Qompile</h2>
<p>These table styles are a cleaned up version of some table styles from a fantasy sports web app. The original table styles were written using regular CSS <code>@media</code> queries, but as soon as the tables needed to be added to a layout with a sidebar or other content we had to re-do the breakpoints all the time and we ended up with a lot of duplicate code.</p>
<p>These tables use <code>containerQuery()</code> instead, via <a href=http://github.com/tomhodgins/qompile>Qompile</a>, so the responsive breakpoints are based on the width of the <code><table></code> elements themselves rather than the width of the browser. This way this one set of responsive styles should be able to style a <code><table></code> placed into any layout.</p>
<br>
<!-- Six Col -->
<table data-table="col-six">
<caption><table data-table=col-six></caption>
<thead>
<tr>
<th>Name</th>
<th>X Axis</th>
<th>Y Axis</th>
<th>Z Axis</th>
<th>Speed</th>
<th>Time</th>
<th>Finish</th>
</tr>
</thead>
<tbody>
<tr>
<td data-heading="Name">Test Flight 1</td>
<td data-heading="X Axis">120°</td>
<td data-heading="Y Axis">40°</td>
<td data-heading="Z Axis">157°</td>
<td data-heading="Speed">1503㎧</td>
<td data-heading="Time">1:05</td>
<td data-heading="Finish">459</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 2</td>
<td data-heading="X Axis">80°</td>
<td data-heading="Y Axis">94°</td>
<td data-heading="Z Axis">30°</td>
<td data-heading="Speed">200㎧</td>
<td data-heading="Time">0:45</td>
<td data-heading="Finish">487</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 3</td>
<td data-heading="X Axis">77°</td>
<td data-heading="Y Axis">78°</td>
<td data-heading="Z Axis">90°</td>
<td data-heading="Speed">55㎧</td>
<td data-heading="Time">1:20</td>
<td data-heading="Finish">458</td>
</tr>
</tbody>
</table>
<!-- Five Col -->
<table data-table="col-five">
<caption><table data-table=col-five></caption>
<thead>
<tr>
<th>Name</th>
<th>X Axis</th>
<th>Y Axis</th>
<th>Z Axis</th>
<th>Speed</th>
<th>Time</th>
</tr>
</thead>
<tbody>
<tr>
<td data-heading="Name">Test Flight 1</td>
<td data-heading="X Axis">120°</td>
<td data-heading="Y Axis">40°</td>
<td data-heading="Z Axis">157°</td>
<td data-heading="Speed">1503㎧</td>
<td data-heading="Time">1:05</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 2</td>
<td data-heading="X Axis">80°</td>
<td data-heading="Y Axis">94°</td>
<td data-heading="Z Axis">30°</td>
<td data-heading="Speed">200㎧</td>
<td data-heading="Time">0:45</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 3</td>
<td data-heading="X Axis">77°</td>
<td data-heading="Y Axis">78°</td>
<td data-heading="Z Axis">90°</td>
<td data-heading="Speed">55㎧</td>
<td data-heading="Time">1:20</td>
</tr>
</tbody>
</table>
<!-- Four Col -->
<table data-table="col-four">
<caption><table data-table=col-four></caption>
<thead>
<tr>
<th>Name</th>
<th>X Axis</th>
<th>Y Axis</th>
<th>Z Axis</th>
<th>Speed</th>
</tr>
</thead>
<tbody>
<tr>
<td data-heading="Name">Test Flight 1</td>
<td data-heading="X Axis">120°</td>
<td data-heading="Y Axis">40°</td>
<td data-heading="Z Axis">157°</td>
<td data-heading="Speed">1503㎧</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 1</td>
<td data-heading="X Axis">120°</td>
<td data-heading="Y Axis">40°</td>
<td data-heading="Z Axis">157°</td>
<td data-heading="Speed">1503㎧</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 2</td>
<td data-heading="X Axis">80°</td>
<td data-heading="Y Axis">94°</td>
<td data-heading="Z Axis">30°</td>
<td data-heading="Speed">200㎧</td>
</tr>
</tbody>
</table>
<!-- Three Col -->
<table data-table="col-three">
<caption><table data-table=col-three></caption>
<thead>
<tr>
<th>Name</th>
<th>X Axis</th>
<th>Y Axis</th>
<th>Z Axis</th>
<th>Speed</th>
<th>Time</th>
<th>Finish</th>
</tr>
</thead>
<tbody>
<tr>
<td data-heading="Name">Test Flight 1</td>
<td data-heading="X Axis">120°</td>
<td data-heading="Y Axis">40°</td>
<td data-heading="Z Axis">157°</td>
<td data-heading="Speed">1503㎧</td>
<td data-heading="Time">1:05</td>
<td data-heading="Finish">459</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 2</td>
<td data-heading="X Axis">80°</td>
<td data-heading="Y Axis">94°</td>
<td data-heading="Z Axis">30°</td>
<td data-heading="Speed">200㎧</td>
<td data-heading="Time">0:45</td>
<td data-heading="Finish">487</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 3</td>
<td data-heading="X Axis">77°</td>
<td data-heading="Y Axis">78°</td>
<td data-heading="Z Axis">90°</td>
<td data-heading="Speed">55㎧</td>
<td data-heading="Time">1:20</td>
<td data-heading="Finish">458</td>
</tr>
</tbody>
</table>
<!-- Two Col -->
<table data-table="col-two">
<caption><table data-table=col-two></caption>
<thead>
<tr>
<th>Name</th>
<th>X Axis</th>
<th>Y Axis</th>
<th>Z Axis</th>
<th>Speed</th>
<th>Time</th>
<th>Finish</th>
</tr>
</thead>
<tbody>
<tr>
<td data-heading="Name">Test Flight 1</td>
<td data-heading="X Axis">120°</td>
<td data-heading="Y Axis">40°</td>
<td data-heading="Z Axis">157°</td>
<td data-heading="Speed">1503㎧</td>
<td data-heading="Time">1:05</td>
<td data-heading="Finish">459</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 2</td>
<td data-heading="X Axis">80°</td>
<td data-heading="Y Axis">94°</td>
<td data-heading="Z Axis">30°</td>
<td data-heading="Speed">200㎧</td>
<td data-heading="Time">0:45</td>
<td data-heading="Finish">18</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 3</td>
<td data-heading="X Axis">77°</td>
<td data-heading="Y Axis">78°</td>
<td data-heading="Z Axis">90°</td>
<td data-heading="Speed">55㎧</td>
<td data-heading="Time">1:20</td>
<td data-heading="Finish">458</td>
</tr>
</tbody>
</table>
<!-- One Col -->
<table data-table="col-one">
<caption><table data-table=col-one></caption>
<thead>
<tr>
<th>Name</th>
<th>X Axis</th>
<th>Y Axis</th>
<th>Z Axis</th>
<th>Speed</th>
<th>Time</th>
<th>Finish</th>
</tr>
</thead>
<tbody>
<tr>
<td data-heading="Name">Test Flight 1</td>
<td data-heading="X Axis">120°</td>
<td data-heading="Y Axis">40°</td>
<td data-heading="Z Axis">157°</td>
<td data-heading="Speed">1503㎧</td>
<td data-heading="Time">1:05</td>
<td data-heading="Finish">40</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 2</td>
<td data-heading="X Axis">80°</td>
<td data-heading="Y Axis">94°</td>
<td data-heading="Z Axis">30°</td>
<td data-heading="Speed">200㎧</td>
<td data-heading="Time">0:45</td>
<td data-heading="Finish">487</td>
</tr>
<tr>
<td data-heading="Name">Test Flight 3</td>
<td data-heading="X Axis">77°</td>
<td data-heading="Y Axis">78°</td>
<td data-heading="Z Axis">90°</td>
<td data-heading="Speed">55㎧</td>
<td data-heading="Time">1:20</td>
<td data-heading="Finish">458</td>
</tr>
</tbody>
</table>