-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtables.html
More file actions
105 lines (88 loc) · 2.54 KB
/
tables.html
File metadata and controls
105 lines (88 loc) · 2.54 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Tables in HTML</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<h1>Tables in HTML</h1>
<p>Learn how to display data in rows and columns using HTML tables.</p>
</header>
<nav>
<a href="index.html">Home</a>
<a href="text.html">First HTML file</a>
<a href="links.html">Links</a>
<a href="images.html">Images</a>
<a href="lists.html">Lists</a>
<a href="tables.html">Tables</a>
<a href="css.html">CSS</a>
</nav>
<div class="content">
<div class="lesson-box">
<h2>Basic Table</h2>
<p>A simple table uses <code><table></code>, rows use <code><tr></code>, and cells use <code><td></code>:</p>
<pre>
<table>
<tr>
<td>Apple</td>
<td>Red</td>
</tr>
<tr>
<td>Banana</td>
<td>Yellow</td>
</tr>
</table>
</pre>
<p>This creates a simple two‑row table.</p>
</div>
<div class="lesson-box">
<h2>Table Headings</h2>
<p>Use <code><th></code> for header cells. They appear bold by default:</p>
<pre>
<table>
<tr>
<th>Fruit</th>
<th>Color</th>
</tr>
<tr>
<td>Apple</td>
<td>Red</td>
</tr>
</table>
</pre>
</div>
<div class="lesson-box">
<h2>Adding Borders</h2>
<p>You can add borders using CSS. For example:</p>
<pre>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
</pre>
<p>This makes your table easier to read.</p>
</div>
<div class="lesson-box">
<h2>Spanning Columns</h2>
<p>Use <code>colspan</code> to make a cell stretch across multiple columns:</p>
<pre>
<td colspan="2">Fruit Colors</td>
</pre>
</div>
<div class="lesson-box">
<h2>Lesson Checkpoint</h2>
<p>Before moving on, make sure you have:</p>
<ol>
<li>Created a table in your <code>index.html</code>.</li>
<li>Used <code><table></code>, <code><tr></code>, <code><td></code>, and <code><th></code>.</li>
<li>Experimented with borders and <code>colspan</code>.</li>
<li>Committed your changes to GitHub.</li>
<li>Viewed your updated site on GitHub Pages.</li>
</ol>
<p>Use the navigation bar to explore your site or review previous lessons.</p>
</div>
</div>
</body>
</html>