Welcome to Episode 13 of the Learn HTML series! In this episode, we’ll explore how to create and style tables using HTML. Tables are used to display tabular data in a structured format.
By the end of this episode, you’ll be able to:
- Create basic tables using
<table>,<tr>,<td>, and<th> - Add table headers and captions
- Use attributes like
colspan,rowspanfor complex layouts - Apply basic styling to tables
An HTML table is structured using the following elements:
<table>: Defines the table<tr>: Table row<td>: Table data/cell<th>: Table header<caption>: Title of the table
<table border="1">
<caption>Student Grades</caption>
<tr>
<th>Name</th>
<th>Subject</th>
<th>Grade</th>
</tr>
<tr>
<td>Varun</td>
<td>Math</td>
<td>A</td>
</tr>
<tr>
<td>Priya</td>
<td>Science</td>
<td>B+</td>
</tr>
</table><td colspan="2">Merged Cell</td>
<td rowspan="3">Vertical Cell</td>You can style tables using internal or external CSS:
table {
border-collapse: collapse;
width: 100%;
}
th, td {
padding: 10px;
border: 1px solid #ccc;
text-align: left;
}
caption {
font-weight: bold;
margin-bottom: 10px;
}- Displaying product lists
- Showing financial data
- Organizing schedules and reports
➡️ Episode 14: Creating Forms in HTML
In the next episode, we’ll learn how to build interactive forms in HTML to collect user input. 📝