This article introduces HTML Tables, covering their various implementations and practical applications through examples. HTML Tables are a structured way to organize data in rows and columns, commonly used in communication, research, and data analysis. They serve purposes such as presenting information, comparing items, and database creation. In HTML, tables are defined with the “table” tag, rows with the “tr” tag, headers with the “th” tag, and cell data with the “td” tag.
Example 1: In this example, we are creating a simple table in HTML using a table tag.
<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<th>Book Name</th>
<th>Author Name</th>
<th>Genre</th>
</tr>
<tr>
<td>The Book Thief</td>
<td>Markus Zusak</td>
<td>Historical Fiction</td>
</tr>
<tr>
<td>The Cruel Prince</td>
<td>Holly Black</td>
<td>Fantasy</td>
</tr>
<tr>
<td>The Silent Patient</td>
<td> Alex Michaelides</td>
<td>Psychological Fiction</td>
</tr>
</table>
</body>
</html>
Example 2: This example explains the use of the HTML Table.
<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Priya</td>
<td>Sharma</td>
<td>24</td>
</tr>
<tr>
<td>Arun</td>
<td>Singh</td>
<td>32</td>
</tr>
<tr>
<td>Sam</td>
<td>Watson</td>
<td>41</td>
</tr>
</table>
</body>
</html>
Not a member yet? Register now
Are you a member? Login now