Skip to content

Commit fd2a9b8

Browse files
committed
build a table component.
1 parent 3a1aa33 commit fd2a9b8

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

starter/06-Components/03-table.html

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<link
7+
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&family=Lato&display=swap"
8+
rel="stylesheet"
9+
/>
10+
11+
<title>Table Component</title>
12+
13+
<style>
14+
/*
15+
SPACING SYSTEM (px)
16+
2 / 4 / 8 / 12 / 16 / 24 / 32 / 48 / 64 / 80 / 96 / 128
17+
18+
FONT SIZE SYSTEM (px)
19+
10 / 12 / 14 / 16 / 18 / 20 / 24 / 30 / 36 / 44 / 52 / 62 / 74 / 86 / 98
20+
*/
21+
22+
/*
23+
MAIN COLOR: #087f5b
24+
GREY COLOR: #343a40
25+
*/
26+
27+
* {
28+
margin: 0;
29+
padding: 0;
30+
box-sizing: border-box;
31+
}
32+
33+
/* ------------------------ */
34+
/* GENERAL STYLES */
35+
/* ------------------------ */
36+
body {
37+
font-family: "Inter", sans-serif;
38+
color: #343a40;
39+
line-height: 1;
40+
display: flex;
41+
justify-content: center;
42+
}
43+
44+
table {
45+
width: 800px;
46+
margin-top: 100px;
47+
font-size: 18px;
48+
/* border: 1px solid #343a40; */
49+
border-collapse: collapse;
50+
51+
/* Another way for center table of overall page. */
52+
/* margin: 0 auto; */
53+
}
54+
55+
th,
56+
td {
57+
/* border: 1px solid #343a40; */
58+
padding: 16px 24px;
59+
text-align: left;
60+
}
61+
thead tr {
62+
background-color: #087f5b;
63+
color: #fff;
64+
}
65+
66+
thead th {
67+
width: 25%;
68+
}
69+
70+
tbody tr:nth-child(odd) {
71+
background-color: #f8f9fa;
72+
}
73+
74+
tbody tr:nth-child(even) {
75+
background-color: #e9ecef;
76+
}
77+
</style>
78+
</head>
79+
<body>
80+
<table>
81+
<thead>
82+
<tr>
83+
<th>Chair</th>
84+
<th>The Laid Back</th>
85+
<th>The Worker Bee</th>
86+
<th>The Chair 4/2</th>
87+
</tr>
88+
</thead>
89+
<tbody>
90+
<tr>
91+
<th>Width</th>
92+
<td>80 cm</td>
93+
<td>60 cm</td>
94+
<td>220 cm</td>
95+
</tr>
96+
<tr>
97+
<th>Height</th>
98+
<td>100 cm</td>
99+
<td>110 cm</td>
100+
<td>90 cm</td>
101+
</tr>
102+
<tr>
103+
<th>Depth</th>
104+
<td>70 cm</td>
105+
<td>65 cm</td>
106+
<td>80 cm</td>
107+
</tr>
108+
<tr>
109+
<th>Weight</th>
110+
<td>16 kg</td>
111+
<td>22 kg</td>
112+
<td>80 kg</td>
113+
</tr>
114+
</tbody>
115+
</table>
116+
</body>
117+
</html>

0 commit comments

Comments
 (0)