Chapter 4 — HTML Tables & Media
📚 Chapter Overview
Displaying data and rich content is vital for modern websites. In this chapter, you will learn how to build structured data tables and embed Audio and Video directly into your pages.
Learning Objectives:
- Build complex tables with
thead,tbody, andtfoot. - Master
colspanandrowspan. - Embed YouTube videos and local Audio files.
4.1 Data Tables
Part 1 — Definition
HTML tables allow web developers to arrange data like text, images, and links into rows and columns of cells. A table is defined with the <table> tag. Each table row is defined with <tr>, and each header/data cell with <th> and <td>.
Part 2 — Syntax
<table>
<tr>
<th>Header</th>
</tr>
<tr>
<td>Data</td>
</tr>
</table>
Part 3 — Example
Problem: Create a "Price List" for services.
<table border="1">
<tr>
<th>Service</th>
<th>Price</th>
</tr>
<tr>
<td>Web Design</td>
<td>$500</td>
</tr>
</table>
Part 4 — Video
Video: Coming Soon
4.2 Audio and Video
Part 1 — Definition
HTML5 introduced native tags for multimedia. The <video> and <audio> tags allow you to embed files without needing external plugins. You must include the controls attribute to show the play/pause buttons.
Part 2 — Syntax
<video src="movie.mp4" controls></video>
<audio src="song.mp3" controls></audio>
Part 3 — Example
Problem: Embed a YouTube video on your page.
<iframe width="560" height="315"
src="https://www.youtube.com/embed/dQw4w9WgXcQ"
frameborder="0" allowfullscreen></iframe>
Observation: iframe is used to embed content from external sources like YouTube or Google Maps.
Part 4 — Video
Video: Coming Soon
🏆 Chapter Challenge
Challenge Objective
Create a "Class Timetable" page with a video tutorial link.
Requirements
- A table showing Monday-Friday schedule.
- Use
colspanto show a single "Lunch Break" across all days. - Embed an educational video below the table.
Step-by-Step Process
- Structure the table with 6 columns (Time + 5 Days).
- Use
<td colspan="5">Lunch</td>in one row. - Add the
<iframe>tag at the bottom.
Expected Deliverables
timetable.htmlsource file.