-
Notifications
You must be signed in to change notification settings - Fork 0
/
table.html
238 lines (219 loc) · 7.22 KB
/
table.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
<!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>DS in CSS - Table</title>
<link rel="stylesheet" type="text/css" href="./css/styles.css">
</head>
<body class="cb-baseline">
<main class="cb-main">
<h1 class="cb-h4 cb-bolder"><a class="cb-link" href="./index.html">DS in CSS</a></h1>
<h2 class="cb-h5 cb-margin-bottom-large">
Table
</h2>
<p>
Use the semantic <code class="cb-inline-code"><table></code>, <code
class="cb-inline-code"><thead></code>, <code class="cb-inline-code"><tbody></code>,
<code class="cb-inline-code"><tr></code>, <code class="cb-inline-code"><th></code>, and
<code class="cb-inline-code"><td></code> elements for DS tables.
</p>
<p>
On the <code class="cb-inline-code"><table></code> element, apply the class <code
class="cb-inline-code">.cb-table</code>.
</p>
<p>
On the <code class="cb-inline-code"><thead></code> element, apply the class <code
class="cb-inline-code">.cb-thead</code>.
</p>
<p>
On the <code class="cb-inline-code"><tr></code> element, apply the class <code
class="cb-inline-code">.cb-tr</code>.
</p>
<p>
On the <code class="cb-inline-code"><th></code> element, apply the class <code
class="cb-inline-code">.cb-th</code>.
</p>
<p>
On the <code class="cb-inline-code"><td></code> element, apply the class <code
class="cb-inline-code">.cb-td</code>.
</p>
<table class="cb-table">
<thead class="cb-thead">
<tr class="cb-tr">
<th class="cb-th">Name</th>
<th class="cb-th">SSN</th>
<th class="cb-th">Status</th>
</tr>
</thead>
<tbody class="cb-tbody">
<tr class="cb-tr">
<td class="cb-td">
Clancy Wiggum
</td>
<td class="cb-td">
•••••1234
</td>
<td class="cb-td">
<div class="cb-chip cb-active">Active</div>
</td>
</tr>
<tr class="cb-tr">
<td class="cb-td">
Charles M. Burns
</td>
<td class="cb-td">
•••••0001
</td>
<td class="cb-td">
<div class="cb-chip">Pending</div>
</td>
</tr>
<tr class="cb-tr">
<td class="cb-td">
Arman Tanzarian
</td>
<td class="cb-td">
•••••5555
</td>
<td class="cb-td">
<div class="cb-chip cb-alert">Disabled</div>
</td>
</tr>
<tr class="cb-tr">
<td class="cb-td">
Seymour Skinner
</td>
<td class="cb-td">
•••••5555
</td>
<td class="cb-td">
<div class="cb-chip cb-active">Active</div>
</td>
</tr>
</tbody>
</table>
<h3 id="fixed-columns-zebra" class="cb-h6 cb-margin-bottom-large cb-margin-top-large">Table with fixed columns and
zebra</h3>
<p>You can also add <code class="cb-inline-code">.cb-fixed</code> to the <code
class="cb-inline-code"><table></code> element for a table fixed-width columns, and add <code
class="cb-inline-code">.cb-zebra</code> for zebra striping (i.e., alternating row background color).</p>
<p>Here's the same table from above, with those two classes added to the <code
class="cb-inline-code"><table></code> element:</p>
<table class="cb-table cb-fixed cb-zebra">
<thead class="cb-thead">
<tr class="cb-tr">
<th class="cb-th">Name</th>
<th class="cb-th">SSN</th>
<th class="cb-th">Status</th>
</tr>
</thead>
<tbody class="cb-tbody">
<tr class="cb-tr">
<td class="cb-td">
Clancy Wiggum
</td>
<td class="cb-td">
•••••1234
</td>
<td class="cb-td">
<div class="cb-chip cb-active">Active</div>
</td>
</tr>
<tr class="cb-tr">
<td class="cb-td">
Charles M. Burns
</td>
<td class="cb-td">
•••••0001
</td>
<td class="cb-td">
<div class="cb-chip">Pending</div>
</td>
</tr>
<tr class="cb-tr">
<td class="cb-td">
Arman Tanzarian
</td>
<td class="cb-td">
•••••5555
</td>
<td class="cb-td">
<div class="cb-chip cb-alert">Disabled</div>
</td>
</tr>
<tr class="cb-tr">
<td class="cb-td">
Seymour Skinner
</td>
<td class="cb-td">
•••••5555
</td>
<td class="cb-td">
<div class="cb-chip cb-active">Active</div>
</td>
</tr>
</tbody>
</table>
<h3 id="cell-alignment" class="cb-h6 cb-margin-bottom-large cb-margin-top-large">Cell alignment</h3>
<p>The table below contains some <code class="cb-inline-code"><th></code> and <code
class="cb-inline-code"><td></code> elements that are formatted for displaying numbers.</p>
<p>Add <code class="cb-inline-code">.cb-text-align-right</code> to a <code
class="cb-inline-code"><th></code> or <code class="cb-inline-code"><td></code> to
align is content to the right.</p>
<p>Add <code class="cb-inline-code">.cb-number</code> to a <code
class="cb-inline-code"><th></code> or <code class="cb-inline-code"><td></code> to
align is content to the right and format numbers to display in a tabular variant.</p>
<p>Here, the <em>Age</em> and <em>Number of pets</em> columns are both formatted for numeric data.</p>
<table class="cb-table cb-fixed">
<thead class="cb-thead">
<tr class="cb-tr">
<th class="cb-th">Name</th>
<th class="cb-th cb-text-align-right">Age</th>
<th class="cb-th cb-text-align-right">Number of pets</th>
<th class="cb-th">Pet type(s)</th>
</tr>
</thead>
<tbody class="cb-tbody">
<tr class="cb-tr">
<td class="cb-td">
Clancy Wiggum
</td>
<td class="cb-td cb-number">
43
</td>
<td class="cb-td cb-number">
1
</td>
<td class="cb-td">Cat</td>
</tr>
<tr class="cb-tr">
<td class="cb-td">
Eleanor Abernathy
</td>
<td class="cb-td cb-number">
80
</td>
<td class="cb-td cb-number">
5,345
</td>
<td class="cb-td">Cat</td>
</tr>
<tr class="cb-tr">
<td class="cb-td">
Homer Simpson
</td>
<td class="cb-td cb-number">
40
</td>
<td class="cb-td cb-number">
2
</td>
<td class="cb-td">Cat, Dog</td>
</tr>
</tbody>
</table>
</main>
</body>
</html>