Lesson 13: HTML Tables

Organizing Data in Tables

HTML tables display structured data using rows and columns with <table>, <tr> (row), <th> (header), and <td> (data cell) tags.

<table>
<tr><th>Header 1</th></tr>
<tr><td>Data 1</td></tr>
</table>

Why&How to use:

Use tables exclusively for tabular data like financial figures, schedules, or pricing comparisons, rather than for overall page layout.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>HTML Tables</title>
</head>
<body>
<h2>User List Table</h2>
<table border="1">
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>John Doe</td>
<td>28</td>
</tr>
</table>
</body>
</html>