Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† Introduction to HTML Level One ยท Lesson 7 of 11

Module Six

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
7
Module 6 - Tables in HTML

Module 6: Tables in HTML

Module Introduction

In the previous module, we learned how to add pictures, audio, and videos to our webpages.

In this module, we will learn how to organize information using tables. Tables help us arrange information into rows and columns, just like a school timetable or a football score sheet.


Lesson 1: What is a Table?

A table is a way of organizing information into rows and columns.

You see tables every day in school timetables, examination results, attendance registers, and football league tables.

Fun Example

Imagine a chocolate bar divided into small squares. Each square is like a cell in a table.


Lesson 2: Creating a Table

We use the <table> tag to create a table.

<table>

</table>

Everything inside the table tag becomes part of the table.


Lesson 3: Creating Rows

Rows go from left to right. We use the <tr> tag to create rows.

<table>
    <tr>
    </tr>
</table>

Fun Example

Think of rows as seats in a classroom. Students sit side by side in the same row.


Lesson 4: Creating Columns and Cells

Cells hold the information inside a table. We use the <td> tag for table data.

<table border="1">
    <tr>
        <td>Tolu</td>
        <td>10</td>
    </tr>
</table>

Output

Tolu 10

Lesson 5: Table Headings

Table headings tell us what information is in each column. We use the <th> tag.

<table border="1">
    <tr>
        <th>Name</th>
        <th>Age</th>
    </tr>

    <tr>
        <td>Tolu</td>
        <td>10</td>
    </tr>
</table>

Output

Name Age
Tolu 10

Lesson 6: Building a School Timetable

Let's create a simple school timetable.

<table border="1">

<tr>
    <th>Time</th>
    <th>Subject</th>
</tr>

<tr>
    <td>8:00 AM</td>
    <td>Mathematics</td>
</tr>

<tr>
    <td>9:00 AM</td>
    <td>English</td>
</tr>

</table>

Fun Example

Tables are like shelves in a library. Each shelf stores information in an organized way.


Lesson 7: Merging Columns

Sometimes we want one cell to take up more than one column. We use the colspan attribute.

<table border="1">

<tr>
    <th colspan="2">
        My Report Card
    </th>
</tr>

</table>

The heading stretches across two columns.


Lesson 8: Merging Rows

Sometimes we want one cell to cover more than one row. We use the rowspan attribute.

<td rowspan="2">
    Football
</td>

This cell will cover two rows.


Complete Example

<!DOCTYPE html>
<html>

<head>
    <title>My Class List</title>
</head>

<body>

<h1>My Class List</h1>

<table border="1">

<tr>
    <th>Name</th>
    <th>Favourite Subject</th>
</tr>

<tr>
    <td>Tolu</td>
    <td>Science</td>
</tr>

<tr>
    <td>Amina</td>
    <td>Mathematics</td>
</tr>

</table>

</body>

</html>

Class Exercise 1

Fill in the blanks:

  1. _____ creates a table.
  2. _____ creates a row.
  3. _____ creates a table heading.
  4. _____ creates a table cell.
  5. _____ merges columns.

Class Exercise 2

Create a table showing:

  • Your Name
  • Your Age
  • Your Favourite Food

Use table headings.


Class Exercise 3

Fix the missing tags below:

<table border="1">

    _____
        _____ Name _____
        _____ Age _____
    _____

    _____
        _____ Tolu _____
        _____ 10 _____
    _____

</table>

Use:

  • <tr>
  • <th>
  • <td>

Mini Project

Create a webpage called myschooltimetable.html.

Add:

  • A heading called "My School Timetable"
  • A table with at least 5 rows
  • Time and Subject columns
  • A border around the table

Challenge Exercise

Create a football score table with:

  • Team Name
  • Matches Played
  • Goals Scored

Add at least three teams.


Module Summary

  • Tables organize information into rows and columns.
  • The <table> tag creates a table.
  • The <tr> tag creates rows.
  • The <td> tag creates cells.
  • The <th> tag creates table headings.
  • Colspan merges columns.
  • Rowspan merges rows.
  • Tables are useful for timetables, reports, and score sheets.

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’