-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2a.html
More file actions
132 lines (126 loc) · 2.63 KB
/
Copy path2a.html
File metadata and controls
132 lines (126 loc) · 2.63 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initialscale=1.0">
<title>Understanding HTML Tables</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
color: #333;
margin: 20px;
}
h1 {
color: #333;
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
table, th, td {
border: 1px solid #333;
}
th, td {
padding: 10px;
text-align: left;
}
th {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h1>Understanding HTML Tables</h1>
<p>In HTML, tables are created using the
<code><table></code> tag. The table is structured with
rows (<code><tr></code>) and cells, which can be either
header cells (<code><th></code>) or data cells
(<code><td></code>). Attributes like
<code>border</code>, <code>rowspan</code>, and
<code>colspan</code> can be used to enhance the table's
appearance and structure.</p>
<h2>Basic Table</h2>
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
<td>Row 1, Cell 3</td>
</tr>
<tr>
<td>Row 2, Cell 1</td>
<td>Row 2, Cell 2</td>
<td>Row 2, Cell 3</td>
</tr>
</table>
<h2>Table with Rowspan</h2>
<p>The <code>rowspan</code> attribute allows a cell to
span multiple rows.</p>
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<td rowspan="2">Rowspan 2 Rows</td>
<td>Row 1, Cell 2</td>
<td>Row 1, Cell 3</td>
</tr>
<tr>
<td>Row 2, Cell 2</td>
<td>Row 2, Cell 3</td>
</tr>
</table>
<h2>Table with Colspan</h2>
<p>The <code>colspan</code> attribute allows a cell to
span multiple columns.</p>
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
<tr>
<td>Row 1, Cell 1</td>
<td colspan="2">Colspan 2 Columns</td>
</tr>
<tr>
<td>Row 2, Cell 1</td>
<td>Row 2, Cell 2</td>
<td>Row 2, Cell 3</td>
</tr>
</table>
<h2>Complex Table Example</h2>
<p>This table combines both <code>rowspan</code> and
<code>colspan</code> attributes.</p>
<table border="1">
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
<th>Header 4</th>
</tr>
<tr>
<td rowspan="2">Rowspan 2 Rows</td>
<td>Row 1, Cell 2</td>
<td colspan="2">Colspan 2 Columns</td>
</tr>
<tr>
<td>Row 2, Cell 2</td>
<td>Row 2, Cell 3</td>
<td>Row 2, Cell 4</td>
</tr>
<tr>
<td>Row 3, Cell 1</td>
<td colspan="3">Colspan 3 Columns</td>
</tr>
</table>
</body>
</html>