<!DOCTYPE html> declaration<html> tag with the lang attribute<head> section: Charset, Viewport, and Title<header>, <nav>, <main>, <section>, <article>, <aside>, and <footer><figure> and <figcaption> elements for associating images with captions<details> and <summary> for collapsible content<em> vs. <i> and <strong> vs. <b><cite>, <blockquote>, and <q> for quotations<abbr><ol>) with start and type attributes<dl>, <dt>, <dd>)<details> and a product review section using <article> and <blockquote>.
/), Document-relative (./, ../)target="_blank" for new tabs (and security considerations)download for file downloadsmailto: and tel: linksid attributes and hash links<picture> element for Responsive Images (Art Direction)srcset attribute for resolution switchingloading="lazy" attribute for performance<video> element: controls, autoplay, loop, and muted attributes<source> tags for different video codecs (MP4, WebM)<track><audio> element and its attributes<iframe><picture>), a video player with controls, and an embedded external map.
<label> with for attributes<fieldset> and <legend>email, tel, url, number, date, color<select>) with grouping (<optgroup>)<textarea>required, pattern, min, and max attributesGET vs. POST methodsaction attribute<thead>, <tbody>, and <tfoot>colspan and rowspan<th> with scope="col" and scope="row"caption and aria-label for complex data tablesrole="banner", role="navigation", and role="main" (and when they are redundant with semantic HTML)<title> tag and Meta Descriptionsh1 โ h6)lang attribute and translation toolsBuild a 5-page static website for a fictional small business (e.g., bakery, portfolio, or tech startup).
<header>, <nav>, <main>, <section>)<figure>, <blockquote>, and <details>)<picture> and <figure>)<article>, <time>, and <aside>)Final Evaluation:
Building the skeleton of every website โ the right way!
Welcome to Module 1 of your HTML Level Two journey!
In Level One, you learned how to write basic tags like <h1>,
<p>, and <img>. You made your first web pages.
That was like learning the alphabet.
Now, in Level Two, we are going to learn how to build proper, professional, and modern web pages โ the kind that make search engines happy, that work on phones and computers, and that everyone can use โ even people who cannot see well.
In this module, we will look at the HTML5 boilerplate โ that is the special starting code that every modern webpage needs. We will also learn about semantic elements โ these are special tags that give meaning to our content. And we will set up our developer tools so that we can check our work like real web developers.
Think of this module as learning how to use the right tools and the right blueprint before you build a house. You would not build a house without a good plan, right? In the same way, you should not build a website without a modern HTML framework!
By the end of this module, you will be able to:
<header>) and generic tags (like <div>).Tunde was a 13-year-old who loved football and computers. He had learned some HTML from his big sister and wanted to build a website for his neighbourhood football team โ the Lagos Lions.
He quickly wrote some HTML using only <div> tags.
He put everything inside <div> โ the team name,
the match scores, the pictures of players, and even the footer.
When he opened it in his browser, it looked okay. But when his sister
looked at the code, she laughed.
โTunde,โ she said, โthis is like putting your shoes in the fridge and your milk in the wardrobe! You are using the wrong containers. The browser can read it, but it does not understand what is important. Google will not know that this part is the main story, and a blind person using a screen reader will be completely lost.โ
Tunde felt sad. But his sister smiled and said, โDonโt worry. Today I will teach you the modern HTML framework. It is like having a proper tool belt. Once you learn this, you will build websites that are strong, smart, and friendly to everyone.โ
And that is exactly what we are going to learn in this module. Let us begin!
Definition: A framework is a basic structure that you build upon. It is like the skeleton of a house โ the beams and posts that hold everything up.
Why important: Without a good framework, your website might look messy, break on different devices, or be hard for search engines to read.
Simple explanation: Imagine you are drawing a person. You start with a stick figure โ that is the framework. Then you add clothes, hair, and details. The HTML framework is like that stick figure for your web page.
Real-life example: When builders construct a house in Lagos, they first lay the foundation and put up the main pillars. Those pillars are the framework. Everything else โ the walls, the roof, the windows โ comes later.
School example: Before writing an essay, you make an outline: Introduction, Body, Conclusion. That outline is your framework.
Home example: Your family might have a weekly timetable โ Monday is laundry, Tuesday is market day. That timetable is the framework for your week.
Nigerian example: In a typical Nigerian market, the stalls are arranged in rows โ foodstuffs here, clothes there. That arrangement is the framework that helps shoppers find things easily.
Illustration (ASCII):
HTML Framework
==============
+------------------+
| <!DOCTYPE> | โ declaration
| <html> | โ root
| <head> | โ metadata (info about page)
| </head> |
| <body> | โ visible content
| </body> |
| </html> |
+------------------+
Definition: The HTML5 boilerplate is a standard template of HTML code that includes all the essential tags a webpage needs. It is like a โstarter kitโ for building websites.
Why important: It ensures that your page works on all browsers, looks good on phones, and is ready for modern web features.
Simple explanation: Think of it like the โbaseโ in a game of football โ it is where you start from. Every player knows where the base is.
Real-life example: When you buy a new phone, it comes with some pre-installed apps โ that is like a boilerplate. You can add more apps later.
School example: Your teacher gives you a worksheet with your name, date, and subject at the top. That is the boilerplate for your homework.
Home example: Your mumโs recipe for jollof rice has the same first steps โ wash the rice, chop the onions, etc. That is the boilerplate for cooking jollof.
Nigerian example: In Nigeria, when you start a letter, you write โDear Sir/Madamโ โ that is a boilerplate opening.
Here is the actual HTML5 boilerplate:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>My Awesome Page</title>
</head>
<body>
<!-- all visible content goes here -->
</body>
</html>
<!DOCTYPE>,
<html>, <head>, and <body> tags.
<!DOCTYPE html> Declaration
Definition: <!DOCTYPE html> is a special instruction
that tells the browser, โHey, this is an HTML5 document. Please read it the right way.โ
Why important: Without it, the browser might use an older, more confusing way to read your page. This can cause your page to look broken.
Simple explanation: It is like telling your teacher, โI am presenting my project in Englishโ โ so the teacher knows which language to listen for.
Real-life example: Before a football match, the referee
checks that both teams are wearing the right kits. The <!DOCTYPE>
is like that referee check โ it makes sure the browser is ready for your page.
School example: When you submit an assignment, you write โMathematicsโ or โEnglishโ at the top so your teacher knows which subject it is.
Home example: You might say โMummy, I am going to schoolโ โ that is a declaration of your activity.
Nigerian example: In Nigeria, before a traditional ceremony, the chief announces, โWe are starting!โ โ that is the declaration.
Illustration:
Browser reads your page:
-----------------------
<!DOCTYPE html> โ "Aha! This is HTML5!"
then reads the rest of the page normally.
<!DOCTYPE html> is the very first
line of your HTML. It tells the browser to use HTML5 mode.
<html> Tag and the lang Attribute
Definition: The <html> tag is the root (the very top)
of your HTML document. Everything else goes inside it. The lang attribute
tells the browser the main language of your page.
Why important: The lang attribute helps screen readers
pronounce words correctly and helps search engines know what language your page is in.
Simple explanation: The <html> tag is like the
cover of a book โ it holds all the pages inside. The lang attribute
is like the label that says โThis book is in English.โ
Real-life example: A book has a cover that holds everything together.
The cover might say โEnglish Editionโ โ that is the lang attribute.
School example: Your exercise book has your name and class on the cover.
Home example: A folder that holds all your school notes has a label.
Nigerian example: In Nigeria, many products have labels in English
and maybe Hausa or Yoruba โ the lang attribute is like saying
โPrimary language: English.โ
Code example:
<html lang="en"> โ "en" means English
... all your content ...
</html>
<html> is the container for everything
on your page. Always add lang="en" (or the right language code)
to help browsers and screen readers.
<head> Section โ Information About Your Page
Definition: The <head> section holds metadata โ
that is data about your page. This information is not visible on the page itself,
but it is very important.
Why important: It tells the browser (and search engines) important things like the character set, the title, and how to make your page look good on phones.
Simple explanation: The <head> is like the
โbrainโ of your page โ it does a lot of thinking behind the scenes.
Real-life example: When you go to a doctor, the doctor looks at
your medical file before seeing you. That file is like the <head>.
School example: Before a lesson, your teacher reads the lesson plan
โ that plan is like the <head> information.
Home example: Your parent might check the weather forecast before deciding what to wear โ that forecast is like metadata.
Nigerian example: Before travelling from Lagos to Abuja,
you check the bus schedule โ that schedule is like the <head>
information that helps you plan.
Illustration:
<head>
+-------------------------------+
| meta charset | โ tells browser to use Unicode
| meta viewport | โ helps with mobile screens
| title | โ shows in browser tab
+-------------------------------+
</head>
<head> holds invisible
but super-important information about your page. It is like the pageโs ID card.
Definition: charset="UTF-8" tells the browser
to use a character set that includes all letters, numbers, and emojis.
viewport tells the browser how to scale your page on mobile phones.
Why important: Without these, your page might show weird symbols instead of letters, and it might look tiny on a phone.
Simple explanation: Charset is like a translator โ it helps the browser understand every character you type. Viewport is like a zoom lens โ it makes sure your page fits nicely on any screen.
Real-life example: A good translator can convert Yoruba, Hausa, and Igbo into English โ that is like UTF-8. Viewport is like adjusting your car mirrors so you can see the road properly.
School example: Your teacher might use a projector. The projector must be adjusted to fit the screen โ that is the viewport.
Home example: When you watch a movie on your phone, you can zoom in or out โ that is like the viewport.
Nigerian example: In Nigeria, we use the Naira sign โฆ. UTF-8 makes sure that โฆ shows up correctly, not as a strange box.
Code:
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title> Tag โ The Name of Your Page
Definition: The <title> tag gives your webpage
a name that appears in the browser tab and in search engine results.
Why important: It is one of the most important things for SEO (Search Engine Optimisation) โ it tells Google what your page is about.
Simple explanation: The title is like the name on your school notebook โ it tells everyone what is inside.
Real-life example: A movie has a title โ โLion Kingโ. That title tells you what to expect. Your webpage title does the same.
School example: Your project has a cover page with a title โ โMy Science Projectโ.
Home example: Your mum might label food containers โ โJollof Riceโ or โStewโ โ that is the title of that container.
Nigerian example: A popular Nigerian movie like โWives on Strikeโ has a title that tells you what the story is about.
Code:
<title>Lagos Lions โ Official Website</title>
<title> is the name of your page.
It shows in the browser tab and helps people (and Google) find your page.
Definition: Semantic elements are HTML tags that clearly describe
their meaning to both the browser and the developer. For example, <header>
means โthis is the top part of my pageโ.
Why important: They help search engines understand your content and help people with disabilities navigate your page.
Simple explanation: Instead of using generic boxes (<div>),
you use special labels like <header>, <nav>,
and <footer> โ it is like labelling your school bag compartments:
โbooksโ, โlunchโ, โstationeryโ.
Real-life example: A library has sections: Fiction, Non-fiction, Childrenโs books. That is semantic organisation.
School example: Your timetable says โMathematicsโ, โEnglishโ, โBreakโ โ each has a meaning.
Home example: Your kitchen has a cupboard for plates, a drawer for cutlery โ each has a specific purpose.
Nigerian example: A market in Lagos has sections โ โFoodstuffsโ, โClothingโ, โElectronicsโ โ that is semantic layout!
Illustration:
Semantics in HTML:
-----------------
<header> โ top part (logo, title)
<nav> โ navigation links
<main> โ the main content
<article> โ a self-contained piece of content
<section> โ a group of related content
<aside> โ side content (like ads or related links)
<footer> โ bottom part (copyright, contact)
<header> and <footer> Elements
Definition: <header> is the top section of a page
or a section. <footer> is the bottom section.
Why important: They organise your page into clear top and bottom areas.
Simple explanation: <header> is like the head of
a person โ it is at the top. <footer> is like the feet โ
they are at the bottom.
Real-life example: A newspaper has a header (the name of the newspaper) and a footer (the page number and date).
School example: Your exercise book has your name at the top (header) and the class at the bottom (footer).
Home example: A letter has the date at the top (header) and your signature at the bottom (footer).
Nigerian example: A Nigerian wedding invitation has the coupleโs names at the top (header) and the venue address at the bottom (footer).
Code:
<header>
<h1>Lagos Lions FC</h1>
<p>The pride of Lagos</p>
</header>
<footer>
<p>ยฉ 2026 Lagos Lions. All rights reserved.</p>
</footer>
<header> is the top,
<footer> is the bottom. They are like the head and feet
of your webpage.
<nav> Element โ Your Websiteโs Compass
Definition: <nav> is used for the main navigation links
on your page โ the links that help users move around your site.
Why important: It tells the browser, โThese are the most important links for getting around.โ Screen readers can also jump straight to the navigation.
Simple explanation: <nav> is like the map or signpost
in a mall that shows you where the shops are.
Real-life example: A university campus has signposts that show โLibraryโ, โCafeteriaโ, โLecture Hallsโ โ that is navigation.
School example: Your school has a notice board with arrows pointing to different classrooms.
Home example: In your house, you have doors that lead to the kitchen, bedroom, and toilet โ those are like navigation links.
Nigerian example: In a typical Nigerian bus park, there are signs saying โAbujaโ, โIbadanโ, โBeninโ โ that is navigation for travellers.
Code:
<nav>
<a href="index.html">Home</a>
<a href="about.html">About Us</a>
<a href="matches.html">Matches</a>
<a href="contact.html">Contact</a>
</nav>
<nav> holds your main menu
or navigation links. It is like the compass of your website.
<main> Element โ The Star of the Show
Definition: <main> holds the main content of your page โ
the unique stuff that is not repeated across pages (like sidebars or footers).
Why important: It helps screen readers jump straight to the main content, and it tells search engines, โThis is the most important part of the page.โ
Simple explanation: Think of a movie โ the <main>
is the movie itself. The trailers and advertisements are like the sidebar or footer.
Real-life example: In a newspaper, the main story on the front page is the main content. The weather forecast on the side is extra.
School example: In your textbook, the main chapter is the lesson โ the glossary at the back is extra.
Home example: At dinner, the main dish is the jollof rice โ the salad and drinks are extra.
Nigerian example: At a Nigerian wedding, the couple is the main focus โ the guests and decorations are around them.
Code:
<main>
<article>
<h2>Our Big Win against Ibadan United</h2>
<p>The Lagos Lions scored three goals...</p>
</article>
</main>
<main> holds the most important
content on your page. Use it only once per page.
<section> and <article> Elements
Definition: <section> groups related content together.
<article> is for self-contained content that could stand alone,
like a blog post or a news story.
Why important: They help break your page into logical blocks, making it easier to read and style.
Simple explanation: A <section> is like a chapter
in a book. An <article> is like a complete story within that chapter.
Real-life example: In a magazine, each story is an article. The magazine is divided into sections like โFashionโ, โSportsโ, โFoodโ.
School example: Your textbook is divided into sections (units) and each unit has articles (sub-topics).
Home example: Your family photo album might have sections for each holiday, and each holiday has separate articles (like Christmas 2023).
Nigerian example: A Nigerian newspaper like โThe Punchโ has sections like โNewsโ, โSportsโ, โBusinessโ. Each section has articles.
Code:
<section>
<h2>Match Reports</h2>
<article>
<h3>Lagos Lions vs Ibadan United</h3>
<p>The Lions won 3-1...</p>
</article>
<article>
<h3>Lagos Lions vs Abuja Eagles</h3>
<p>A tough match ended in a draw...</p>
</article>
</section>
<section> for groups of related
content and <article> for self-contained pieces like a blog post.
<aside> Element โ The Sidekick
Definition: <aside> holds content that is related
to the main content but not part of it โ like sidebars, ads, or related links.
Why important: It tells the browser, โThis is extra information that might be useful, but it is not the main thing.โ
Simple explanation: Think of a superhero movie โ the main hero
is the main content; the sidekick is the <aside> โ helpful,
but not the star.
Real-life example: On a news website, the main story is in the middle, and there is a sidebar with โMost Readโ or โAdsโ โ that is an aside.
School example: In your notebook, the main notes are in the centre, and you might have little margin notes โ those are like asides.
Home example: In your living room, the main sofa is the main furniture, and a small side table is the aside.
Nigerian example: In a Nigerian restaurant, the main food is the main content, and the small pepper sauce container on the side is the aside.
Code:
<aside>
<h3>Related Links</h3>
<ul>
<li><a href="#">Buy Lagos Lions Jersey</a></li>
<li><a href="#">Upcoming Matches</a></li>
</ul>
</aside>
<aside> is for extra content
that is related but not essential. It is like a sidekick to your main content.
Definition: A semantic webpage uses the right tags for the right parts, making it clear, organised, and accessible.
Why important: It makes your page beautiful to read, easy for search engines to understand, and friendly to people with disabilities.
Simple explanation: It is like having a well-organised wardrobe โ shirts go here, trousers there, shoes here โ everything has its place.
Real-life example: A well-designed library is easy to navigate because it has clear sections and signs.
School example: A well-written essay has paragraphs, headings, and a clear structure โ that is semantic writing.
Home example: Your kitchen is organised with labelled containers โ that is semantic organisation.
Nigerian example: A well-organised market in Lagos has sections clearly marked โ that is semantic market design!
Illustration (complete semantic structure):
<body>
+------------------------------------------+
| <header> |
| <h1>Lagos Lions</h1> |
| <nav> Home | About | Matches </nav> |
| </header> |
+------------------------------------------+
| <main> |
| <section> |
| <article> ... </article> |
| <article> ... </article> |
| </section> |
| <aside> Related links </aside> |
| </main> |
+------------------------------------------+
| <footer> |
| ยฉ 2026 Lagos Lions |
| </footer> |
+------------------------------------------+
</body>
Definition: Developer Tools (DevTools) are built into your browser. They let you inspect the HTML, CSS, and JavaScript of any webpage.
Why important: They help you see exactly what is happening on your page, find mistakes, and learn from other websites.
Simple explanation: It is like having X-ray vision for websites โ you can see the code behind the page.
Real-life example: A mechanic lifts the bonnet of a car to see the engine โ DevTools lets you look under the bonnet of a webpage.
School example: In science class, you use a microscope to see tiny things โ DevTools is like a microscope for code.
Home example: Your mum might open the back of a remote control to check the batteries โ that is inspecting the device.
Nigerian example: In Nigeria, a mechanic in Nnewi might check the engine of a bus โ DevTools is like that for websites.
How to open DevTools:
index.html.<!DOCTYPE html> on the first line.<html lang="en"> on the second line.<html> tag, add <head> and <body>.<head>, add <meta charset="UTF-8" />.<meta name="viewport" content="width=device-width, initial-scale=1.0" />.<title>Your Page Title</title>.<body>, add your visible content.<main> element was introduced in HTML5 to help screen readers.lang attribute can be set to ha for Hausa, yo for Yoruba, and ig for Igbo? You can build websites in Nigerian languages!<title> first โ so your title is like a handshake with your visitor.<!DOCTYPE html>.lang attribute in <html>.charset and viewport meta tags in <head>.<header>, <nav>, <main>, etc.) instead of generic <div>.<p> without </p>.<div> for everything when a semantic tag would be better.lang attribute โ always include it for accessibility.<body> without a proper structure.<title> tag โ every page needs a title!
+---------------------------+
| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset> |
| <meta viewport> |
| <title>...</title> |
| </head> |
| <body> |
| (your content) |
| </body> |
| </html> |
+---------------------------+
Header
|
V
Navigation
|
V
+------------------+
| Main |
| +------------+ |
| | Article | |
| | Article | |
| +------------+ |
| | Aside | |
| +------------+ |
+------------------+
|
V
Footer
Your HTML file
|
V
Browser receives file
|
V
Reads <!DOCTYPE html> โ "Ah, HTML5!"
|
V
Builds the DOM (Document Object Model)
|
V
Renders the page on screen
|
V
๐ Page is visible!
| Semantic Tag | Non-Semantic Equivalent | What it means |
|---|---|---|
<header> |
<div class="header"> |
Top part of page or section |
<nav> |
<div class="nav"> |
Navigation links |
<main> |
<div class="main"> |
Main content of the page |
<section> |
<div class="section"> |
Group of related content |
<article> |
<div class="article"> |
Self-contained content |
<aside> |
<div class="aside"> |
Side content (related but extra) |
<footer> |
<div class="footer"> |
Bottom part of page or section |
| Meta Tag | Purpose | Example |
|---|---|---|
charset |
Sets the character encoding | UTF-8 |
viewport |
Controls layout on mobile | width=device-width, initial-scale=1.0 |
description |
Page summary for search engines | Lagos Lions official website |
keywords |
Keywords for SEO (less used now) | football, Lagos, Lions |
author |
Name of the page author | Tunde Adebayo |
Well done, champion! ๐ You have completed Module 1 of HTML Level Two.
Let us recap what you have learned:
<!DOCTYPE html> and the lang attribute.<head> section does and why we need charset and viewport.<header>, <nav>, <main>, <section>, <article>, <aside>, and <footer>.You now have the solid foundation you need to build modern, meaningful, and well-structured web pages. You are no longer just writing HTML โ you are crafting the web with purpose!
<!DOCTYPE>?<div> instead of <header>?UTF-8 mean?lang attribute important?<main> on a page?<section> and <article>?<section> is a group of related content. An <article> is a self-contained piece that could stand alone.Match the tag on the left with its correct description on the right.
| Tag | Description |
|---|---|
<header> |
A. Holds the main navigation links |
<nav> |
B. Contains the main content of the page |
<main> |
C. The top part of a page or section |
<aside> |
D. Self-contained content like a blog post |
<article> |
E. Side content, like ads or related links |
<footer> |
F. The bottom part of a page or section |
(Answers: 1-C, 2-A, 3-B, 4-E, 5-D, 6-F)
Scenario 1: You are building a website for a Nigerian restaurant called โMamaโs Kitchenโ. The page needs a top section with the restaurant name, a menu with links to different pages (Home, Menu, Contact), the main section with todayโs specials, a sidebar with opening hours, and a bottom section with the address.
Question: Which semantic tags would you use for each part? Write the HTML structure.
Scenario 2: Your school is creating a news page. There will be a header with the school name, a navigation bar, three news articles, and a footer with the schoolโs motto. Draw the structure using semantic tags.
Question: Write the HTML skeleton for this page.
Activity: In groups of 3โ4 students, choose a local business in your area (like a supermarket, a salon, or a pharmacy). Discuss and write down the semantic structure for that businessโs website. Decide together:
<header>?<nav>?<main> content?<aside>?<footer>?Then, draw the layout on paper using boxes and labels.
Activity: Write a complete HTML5 boilerplate from memory. Then, add a <header> with your name, a <nav> with three fake links, a <main> with a short paragraph about your favourite hobby, and a <footer> with โMade with ๐ by [your name]โ. Save it as index.html and open it in your browser.
Instructions: Build a one-page website for the Lagos Lions football team using only semantic HTML. Your page must include:
<header> with the team name and logo (use a heading).<nav> with at least 4 links (they can be fake, like #home, #matches, #players, #contact).<main> section with at least two <article> elements (e.g., latest match report and player interview).<section> inside <main> that groups the articles.<aside> with upcoming match dates.<footer> with the teamโs motto and contact email.Bonus: Add a <figure> with a pretend team photo (use a placeholder image like https://picsum.photos/400/200).
Assignment: Create a semantic HTML page for your favourite Nigerian food (e.g., Jollof Rice, Egusi Soup, or Suya). Your page should have:
<header> with the food name.<nav> with links to โRecipeโ, โIngredientsโ, โHistoryโ.<main> with the recipe steps (use <article> or <section>).<aside> with serving suggestions.<footer> with a fun fact about the food.<figure> with a description of the food.Submit your HTML file.
<header>, <nav>, <main>, <section>, <article>, <aside>, and <footer>.<div> tags?<main> element to someone who has never coded before?<header>, <nav>, <main>, and <footer>?Congratulations on finishing Module 1! You have built a strong foundation. In Module 2, we will go deeper into Advanced Text & Content Structuring. You will learn about:
<figure> and <figcaption> for images with captions.<details> and <summary>.<em>, <strong>, <blockquote>, and <cite> to add meaning to your text.Before you start Module 2, make sure you can write the complete HTML5 boilerplate without looking it up. Practice it a few times. Also, try to explain semantic tags to a friend or family member โ teaching others is the best way to learn!
Keep up the great work. You are on your way to becoming a web developer! ๐ป๐
Module 1: The Modern HTML Framework • Written with ๐ for young coders in Nigeria and around the world.
Making your content meaningful, beautiful, and fun!
Welcome to Module 2 of your HTML Level Two journey!
In Module 1, you learned how to build the modern HTML framework.
You discovered the boilerplate, the <head> section,
and the power of semantic tags like <header>,
<nav>, and <footer>.
Now, in Module 2, we are going to dive deep into the content itself โ the words, the pictures, the quotes, and the lists. You already know how to write a basic paragraph or a simple list. But now we will learn how to make your content rich, meaningful, and beautiful โ the way professional web developers do it.
We will learn about figure and figcaption for adding captions to images. We will explore details and summary to create collapsible content โ like a magic box that opens and closes. We will understand the difference between emphasis and strong importance. We will learn how to quote people properly and how to cite sources. And we will build amazing nested lists and definition lists.
Think of this module as learning the art of writing beautiful, meaningful content for the web. It is not just about putting words on a page โ it is about giving those words power, meaning, and structure.
Let us begin our adventure into the world of advanced text and content structuring!
By the end of this module, you will be able to:
<figure> and <figcaption> to add captions to images and other media.<details> and <summary>.<em> and <i> โ and know when to use each.<strong> and <b> โ and know when to use each.<blockquote>, <q>, and <cite> to quote sources properly.<dl>, <dt>, and <dd>.Chidi was a 13-year-old boy who loved cooking. His specialty was Egusi soup โ a delicious Nigerian soup made with melon seeds, vegetables, and meat. His friends and family always asked him for the recipe.
One day, Chidi decided to create a recipe blog so that everyone could learn how to make his Egusi soup. He wrote the recipe using simple HTML he learned in Level One. He had headings, paragraphs, and a list of ingredients.
But his big sister, who was a web developer, looked at his blog and said, โChidi, this is good โ but it is basic. You can make it much better! You can add pictures with captions, you can make the steps collapsible, you can emphasise the important parts, and you can even add a definition list for cooking terms.โ
Chidi was excited. He spent the whole weekend learning advanced text and content structuring. By the end, his recipe blog was not just a page โ it was a masterpiece! People loved it, and his blog became very popular.
In this module, you will learn exactly what Chidi learned. You will learn how to make your content rich, meaningful, and professional. Let us get started!
<figure> Element โ Your Contentโs Frame
Definition: The <figure> element
is a container that holds media like images, videos, or diagrams
โ along with a caption that describes them.
Why important: It groups the media and its caption together, so they are always connected. This makes your page more organised and accessible.
Simple explanation: Imagine you have a beautiful
picture in a frame. The frame holds the picture and the little
label underneath that says what the picture is about.
<figure> is the frame, and the label is the
<figcaption>.
Real-life example: In a museum, each painting has a frame and a small card next to it with the artistโs name and the title. That card is like a caption.
School example: In your science textbook, diagrams have labels underneath them โ those are captions.
Home example: Your family photo album has pictures with little notes like โChristmas 2025โ โ those are captions.
Nigerian example: In a Nigerian newspaper, photos of events have captions that say โGovernor at the Lagos Book Fairโ โ that is a caption.
Illustration:
<figure>
+----------------------------------+
| [Your image or media here] |
| <img src="egusi.jpg"> |
| <figcaption> |
| A bowl of delicious Egusi |
| soup with meat and fish. |
| </figcaption> |
+----------------------------------+
</figure>
Code example:
<figure>
<img src="egusi-soup.jpg" alt="A bowl of Egusi soup" />
<figcaption>My famous Egusi soup โ ready to eat!</figcaption>
</figure>
<figure> is a container
for media (like images) and its caption. It keeps them together
and makes your page more organised.
<figcaption> Element โ The Label
Definition: <figcaption> is the
caption or label for the content inside a <figure>.
Why important: It provides a clear description of the media, which helps people understand it โ especially people who cannot see the image.
Simple explanation: The <figcaption>
is like the name tag on your school bag. It tells everyone what
is inside (or what it is).
Real-life example: In a zoo, each animal enclosure has a sign that says the animalโs name and where it comes from. That sign is like a figcaption.
School example: In your art class, you might put a label under your drawing that says โMy Self-Portraitโ.
Home example: Your mum might label a jar in the kitchen as โSugarโ โ that is a caption for that jar.
Nigerian example: In a Nigerian market, a seller might have a sign that says โFresh Tomatoesโ โ that is like a caption for the tomatoes.
Illustration:
<figure>
<img src="plantain.jpg" alt="Fried plantain" />
<figcaption>Sweet fried plantain โ a Nigerian favourite!</figcaption>
</figure>
<figcaption> is the
description or label for the media inside a <figure>.
It helps everyone understand what they are looking at.
<details> Element โ The Magic Box
Definition: <details> creates
a section that the user can open and close to reveal hidden content.
Why important: It helps you hide extra information that might be too long or distracting. Users can click to see it only when they want to.
Simple explanation: Imagine a magic box
that is closed. You can click on it, and it opens to reveal
a surprise inside! <details> is like that box.
Real-life example: In a restaurant, the menu might have a โClick to see ingredientsโ button โ that is like the details element.
School example: Your textbook might have โClick to see the answerโ for practice questions โ that is using details and summary.
Home example: Your family might have a โWhatโs for dinner?โ section that you can click to see the menu.
Nigerian example: On a Nigerian news website, there might be a โClick to read moreโ section โ that is the details element.
Illustration:
<details>
+----------------------------------+
| <summary>Click to see recipe</summary> โ visible part
| (hidden content appears here) |
| Step 1: Wash the rice... |
| Step 2: Cook the chicken... |
+----------------------------------+
</details>
Code example:
<details>
<summary>๐ Click to see the full recipe</summary>
<p>Step 1: Wash the rice thoroughly.</p>
<p>Step 2: Cook the chicken with spices.</p>
<p>Step 3: Add the rice and cook until soft.</p>
</details>
<details> creates
a collapsible section. Users click to open or close it.
<summary> Element โ The Title of the Box
Definition: <summary> is the
clickable heading or title of a <details> element.
It is always visible.
Why important: It tells the user what is inside
the <details> box before they click it.
Simple explanation: The <summary>
is like the title on the cover of a book โ it tells
you what the book is about before you open it.
Real-life example: A DVD case has a title on the cover โ that is the summary. You open the case to see the DVD inside.
School example: Your exercise book has a subject written on the cover โ that is like a summary.
Home example: A storage box in your room might have a label that says โToysโ โ that is the summary.
Nigerian example: In a Nigerian market, a shop might have a sign that says โPhones and Accessoriesโ โ that is like a summary.
Code example:
<details>
<summary>๐ฒ Egusi Soup Recipe (click to expand)</summary>
<p>Ingredients: melon seeds, vegetables, meat...</p>
</details>
<summary> is the
clickable title of a <details> element. It is
always visible and tells you what is inside.
<em> vs <i> โ Emphasis vs Italics
Definition: <em> means
emphasis โ it changes the meaning of the sentence.
<i> just makes the text italic for style.
Why important: <em> tells
screen readers to stress the word, which changes how it is understood.
<i> is just for visual style (like a book title).
Simple explanation: <em> is
like raising your voice to stress a word.
<i> is like writing in a special font
just for style โ it does not change the meaning.
Real-life example: If you say โI really want to goโ โ the word โreallyโ is stressed. But if you write โThe book is called Things Fall Apartโ โ that is just a title.
School example: Your teacher might say, โYou must submit your homeworkโ โ that is emphasis. The name of your textbook is in italics.
Home example: Your mum says, โYou must finish your vegetablesโ โ that is emphasis. The name of your favourite movie is in italics.
Nigerian example: A Nigerian chef might say, โYou must use fresh pepperโ โ that is emphasis. The name of a restaurant might be in italics.
Illustration:
<em>I really want to go</em> โ stress on "really"
<i>Things Fall Apart</i> โ just a book title in italics
Code example:
<p>I <em>really</em> love Egusi soup.</p>
<p>My favourite book is <i>Things Fall Apart</i>.</p>
<em> adds
meaning and stress to a word. <i> is just
for visual style โ it does not change meaning.
<strong> vs <b> โ Strong Importance vs Bold
Definition: <strong> indicates
that content is very important or urgent.
<b> just makes text bold for style.
Why important: <strong> tells
screen readers to say it with more force. <b>
is just visual โ it does not add meaning.
Simple explanation: <strong>
is like shouting a warning. <b>
is like making text darker to catch your eye โ but it is
not a warning.
Real-life example: A sign that says โDANGER: DO NOT ENTERโ โ that is strong. A menu that says โTodayโs Specialโ โ that is just bold.
School example: Your teacher writes โThis will be on the examโ โ that is strong. The title of a chapter is bold โ that is just style.
Home example: A note on the fridge says โMilk expires tomorrow!โ โ that is strong. A recipe title is bold โ that is just style.
Nigerian example: A road sign says โSPEED LIMIT 40โ โ that is strong. A shop name might be in bold โ that is just style.
Illustration:
<strong>DANGER: DO NOT ENTER</strong> โ very important warning
<b>Today's Special</b> โ just a bold title
Code example:
<p><strong>Warning:</strong> The soup is very hot!</p>
<p><b>Ingredients:</b> Melon seeds, vegetables, meat.</p>
<strong>
adds importance or urgency. <b> is just
visual boldness โ it does not add meaning.
<blockquote> Element โ Long Quotes
Definition: <blockquote>
is used for long quotations โ like a whole paragraph
from a book or an interview.
Why important: It tells the browser, โThis is a quote from someone else.โ It usually indents the text and helps with accessibility.
Simple explanation: <blockquote>
is like a speech bubble in a comic strip.
It shows that these words are coming from someone else.
Real-life example: In a news article, when they quote the President, they put that quote in a blockquote.
School example: In your English essay, you might quote a famous poem โ you would put that in a blockquote.
Home example: If your grandma says something wise, you might write it as a quote on the wall.
Nigerian example: A Nigerian newspaper quoting the Governor โ โThe Governor said, โWe will build more schools.โโ
Illustration:
<blockquote>
+------------------------------------------+
| "Education is the most powerful weapon |
| which you can use to change the world." |
| โ Nelson Mandela |
+------------------------------------------+
</blockquote>
<blockquote>
is for long quotations. It tells the browser that these words
are from someone else.
<q> Element โ Short Quotes
Definition: <q> is used for
short quotations that are placed inside a sentence.
Why important: It tells the browser that this is a quote, and browsers automatically add quotation marks around it.
Simple explanation: <q> is
like a small speech bubble that fits inside
a sentence.
Real-life example: Your friend says,
โI am coming,โ and you tell someone, โMy friend said
I am coming
.โ
School example: Your teacher says,
โThe answer is 42,โ and you write in your notes,
โThe teacher said the answer is 42
.โ
Home example: Your mum says,
โDinner is ready,โ and you tell your sibling,
โMum said dinner is ready
.โ
Nigerian example: A news headline might say,
โThe minister said we will fix the roads
.โ
Code example:
<p>My friend said <q>I love Egusi soup!</q></p>
<q> is for
short quotes inside a sentence. Browsers add quotation marks
automatically.
<cite> Element โ Giving Credit
Definition: <cite> is used to
cite (give credit to) a source โ like the title
of a book, a movie, a song, or a website.
Why important: It tells the reader where the quote or idea came from. It is like giving thanks to the original author.
Simple explanation: <cite>
is like the footnote in a book that says
โSource: Wikipediaโ.
Real-life example: When you write an essay and you mention a book, you write the bookโs title in italics โ that is a citation.
School example: In your project, you write โInformation from Wikipediaโ โ that is citing.
Home example: Your dad might say, โAs they say in Lion King, โHakuna Matata!โโ
Nigerian example: A blog post might say, โAccording to Punch Newspaper...โ
Code example:
<p>As mentioned in <cite>Things Fall Apart</cite> by Chinua Achebe.</p>
<cite>
gives credit to the source of a quote or idea. It is like
saying โThank youโ to the original author.
<abbr> Element โ Short Forms
Definition: <abbr> is used for
abbreviations โ like โHTMLโ, โCSSโ, or โNigerianโ.
It can also show the full meaning when you hover over it.
Why important: It helps people understand what the abbreviation means, especially if they are new to the topic.
Simple explanation: <abbr>
is like a translation guide โ it tells you what
the short form stands for.
Real-life example: On a form, you might see โNGโ โ the title explains that NG stands for Nigeria.
School example: Your teacher writes โMathsโ on the board โ the title explains that Maths stands for Mathematics.
Home example: Your mum might write โMOHโ โ the title explains it.
Nigerian example: On a government website, you might see โNYSCโ โ the title explains it.
Code example:
<p>I am learning <abbr title="HyperText Markup Language">HTML</abbr>.</p>
<abbr>
is used for abbreviations. It can show the full meaning
when you hover over it.
<dl>, <dt>, and <dd>
Definition: A definition list is a list of
terms and their definitions.
It uses <dl> (the list),
<dt> (the term), and <dd>
(the definition).
Why important: It is perfect for glossaries, dictionaries, or any time you need to explain a term.
Simple explanation: Think of your school dictionary โ it has words and their meanings. A definition list is exactly like that, but on a webpage.
Real-life example: A cooking website might have a definition list for cooking terms โ โBlanch: to boil brieflyโ.
School example: Your science textbook has a glossary at the end โ that is a definition list.
Home example: Your family might have a list of nicknames โ โChidi: the jollof masterโ โ that is like a definition list.
Nigerian example: A website about Nigerian food might have a definition list โ โEgusi: melon seed soupโ.
Illustration:
<dl>
+----------------------------------+
| <dt>HTML</dt> | โ term
| <dd>HyperText Markup Language</dd> | โ definition
| <dt>CSS</dt> |
| <dd>Cascading Style Sheets</dd> |
+----------------------------------+
</dl>
Code example:
<dl>
<dt>Egusi</dt>
<dd>A soup made from melon seeds, popular in Nigeria.</dd>
<dt>Jollof Rice</dt>
<dd>A one-pot rice dish cooked with tomatoes and spices.</dd>
</dl>
<dt>) and
definitions (<dd>) inside a
<dl>.
Definition: A nested ordered list is a list
inside another list โ like a sub-list. You can customise the
numbering with the type and start
attributes.
Why important: It helps you show step-by-step instructions that have sub-steps โ like a recipe or a project plan.
Simple explanation: Imagine you are writing a recipe. Step 1 is โPrepare ingredientsโ. Under Step 1, you have sub-steps: โa) Wash the riceโ, โb) Chop the onionsโ. That is a nested list.
Real-life example: A project plan โ the main steps are numbered 1, 2, 3, and each main step has sub-steps like a, b, c.
School example: Your essay outline โ Roman numerals (I, II, III) with letters (A, B, C) underneath.
Home example: Your weekend plan โ โ1. Saturday: a) Wake up, b) Eat breakfast, c) Go to the marketโ.
Nigerian example: A Nigerian party planning list โ โ1. Food: a) Jollof, b) Fried rice, c) Chickenโ.
Illustration:
<ol>
<li>Prepare ingredients
<ol type="a">
<li>Wash the rice</li>
<li>Chop the onions</li>
</ol>
</li>
<li>Cook the soup
<ol type="i">
<li>Boil the meat</li>
<li>Add the vegetables</li>
</ol>
</li>
</ol>
Code example:
<ol>
<li>Prepare the Egusi soup
<ol type="a">
<li>Soak the melon seeds</li>
<li>Grind the seeds into a paste</li>
</ol>
</li>
<li>Cook the soup
<ol type="i">
<li>Add the meat and fish</li>
<li>Stir and let it simmer</li>
</ol>
</li>
</ol>
type and start.
type and start Attributes for Lists
Definition: The type attribute
changes the numbering style (like 1, A, a, I, i). The
start attribute changes the starting number.
Why important: They let you customise your lists to match any style you need โ like Roman numerals for an outline or letters for sub-steps.
Simple explanation: type is like
choosing the font for your numbers โ numbers,
letters, or Roman numerals. start is like
choosing where to begin โ like starting at 5
instead of 1.
Real-life example: A legal document might use Roman numerals (i, ii, iii) for sections.
School example: Your exam paper might have questions numbered 1, 2, 3, but sub-questions are a, b, c.
Home example: You might number your chores starting from 1, but if you have a list of tasks, you might use letters.
Nigerian example: A Nigerian constitution might use Roman numerals for articles.
Illustration:
<ol type="A" start="3">
<li>This will be C</li> (because it starts at 3 โ A=1, B=2, C=3)
<li>This will be D</li>
</ol>
Code example:
<ol type="I" start="5">
<li>This is V (5)</li>
<li>This is VI (6)</li>
</ol>
type changes
the numbering style (numbers, letters, Roman numerals).
start changes where the numbering begins.
<em>).<strong>).<i>).<b>).<q>).<cite>).<dl>).<em>, <strong>), while others are just for style (<i>, <b>). Always choose meaning when you can.<figure> and <details> help people with disabilities understand your content better.<details> element adds simple interactivity without needing JavaScript โ users can click to open and close.<figure>.<img> tag).<figcaption> with your description.</figure>.<details>.<summary> with a clickable title.</details>.<dl>.<dt> for each term.<dd> for each definition.</dl>.<figure> for each recipe photo with a caption describing the dish.<blockquote> to quote politicians and <cite> to give credit to the source.<dl> to define words.<figure> for pictures of Jollof rice with captions like โA plate of Jollof rice with chickenโ.<blockquote> and cites the source using <cite>.<dl> to define terms like โWAECโ, โJAMBโ, and โNYSCโ.<figure> for the game cover with a caption โMy favourite game!โ<details> element that hides the answers so you can try it yourself first.<figure> for a photo of your bag with a caption โMy school bagโ.<details> to hide the full recipe until you click.<figure> and <figcaption> whenever they add images โ it is a great habit.<details> element for a fun fact about themselves โ it teaches interactivity.<em>, <strong>) and style (<i>, <b>) by giving everyday examples.<details> and <summary> elements were introduced in HTML5 and are supported by all modern browsers.<em> and <strong> differently โ they change the tone of voice.<blockquote> element automatically adds margins on both sides to make it stand out.<details> elements inside each other โ like a box inside a box?<figure> can also hold videos, code snippets, and even diagrams โ not just images?<cite> element is often used in bibliographies and academic writing?<figure> and <figcaption> together for media with captions.<details> and <summary> for content you want to hide or show.<em> and <strong> for meaning, not just for style.<blockquote> for long quotes and <q> for short ones.<cite> when you quote or refer to a source.<dl>) for glossaries and word lists.<i> for emphasis instead of <em>. Remember โ <i> is just style!<b> for importance instead of <strong>. Use <strong> for meaning.<details> or <figure> tags.<figcaption> inside a <figure> โ it is best practice to always add one.<blockquote> for short quotes โ use <q> for short ones.<figure> and <figcaption> for images that need a description.<details> for long or extra content โ it keeps your page clean.<em> and <strong> over <i> and <b> whenever you want to add meaning.<cite> โ it shows respect.
<figure>
+---------------------------+
| [Image] |
| <img src="egusi.jpg"> |
| <figcaption> |
| Egusi soup โ my |
| favourite dish! |
| </figcaption> |
+---------------------------+
</figure>
<details>
+----------------------------------+
| <summary>๐ Click to reveal</summary> โ always visible
| +----------------------------+ |
| | Hidden content appears | |
| | here when you click. | |
| | Surprise! ๐ | |
| +----------------------------+ |
+----------------------------------+
</details>
1. Step 1
a. Sub-step A
b. Sub-step B
2. Step 2
i. Sub-step i
ii. Sub-step ii
<dl>
<dt>HTML</dt>
<dd>HyperText Markup Language</dd>
<dt>CSS</dt>
<dd>Cascading Style Sheets</dd>
</dl>
| Meaning Tag | Style Tag | When to use |
|---|---|---|
<em> |
<i> |
Use <em> to stress a word. Use <i> for book titles, foreign words, or style. |
<strong> |
<b> |
Use <strong> for importance. Use <b> for visual boldness. |
<blockquote> |
<q> |
Use <blockquote> for long quotes. Use <q> for short quotes inside a sentence. |
| List Type | Tags | Best used for |
|---|---|---|
| Unordered List | <ul> and <li> |
Bullet points โ things with no specific order |
| Ordered List | <ol> and <li> |
Step-by-step instructions or rankings |
| Definition List | <dl>, <dt>, <dd> |
Glossaries, terms and definitions |
| Nested List | Any list inside another list | Sub-steps, outlines, detailed plans |
Amazing work, future web developer! ๐ You have completed Module 2 of HTML Level Two.
Let us recap what you have learned:
<figure> and <figcaption> to add captions to images and media.<details> and <summary>.<em> (meaning) and <i> (style).<strong> (meaning) and <b> (style).<blockquote> for long quotes and <q> for short quotes.<cite>.<abbr> for abbreviations.<dl>, <dt>, and <dd>.type and start.You now know how to make your content rich, meaningful, and engaging โ like a professional blogger or news writer. Your web pages will not just be read; they will be understood and enjoyed by everyone.
<figure> and just using <div> with an image?<figure> is semantic โ it tells the browser that the content is a figure with a caption. <div> is generic and has no meaning.<details> without a <summary>?<summary> so users know what is inside.<em> and <strong> affect SEO?<blockquote> and just using quotation marks?<blockquote> is a semantic tag โ it tells the browser โthis is a quoteโ. It also helps screen readers and search engines.<cite> inside a <blockquote>?<cite> inside to show the source of the quote.<dd>, including lists!type attribute (e.g., type="A") and the start attribute (e.g., start="5").<abbr> for any abbreviation?Match the tag on the left with its correct description on the right.
| Tag | Description |
|---|---|
<figure> |
A. A collapsible section that can be opened and closed |
<figcaption> |
B. The caption or label for media inside a figure |
<details> |
C. A container for media and its caption |
<summary> |
D. The clickable title of a details element |
<em> |
E. Adds emphasis to a word |
<strong> |
F. Indicates very important content |
<blockquote> |
G. A long quotation |
<cite> |
H. Gives credit to a source |
<dl> |
I. A definition list |
(Answers: 1-C, 2-B, 3-A, 4-D, 5-E, 6-F, 7-G, 8-H, 9-I)
Scenario 1: You are building a website for a Nigerian restaurant. You want to show a picture of Jollof rice with a caption that says โOur signature Jollof rice โ a customer favourite!โ. You also want to hide the full recipe behind a โClick to see recipeโ button.
Question: Write the HTML code for this using <figure>, <figcaption>, <details>, and <summary>.
Scenario 2: You are writing a blog post about your favourite Nigerian singer. You want to quote a line from their song and give credit. You also want to define some music terms in a glossary.
Question: Write the HTML code that uses <blockquote>, <cite>, and a definition list for the glossary.
Activity: In groups of 3โ4 students, choose a topic you are all interested in โ like โNigerian Foodโ, โFootballโ, or โMoviesโ. Create a webpage together that includes:
<figure> with a <figcaption>.<details> element with a <summary>.<blockquote> with a <cite>.<dl>) with at least 3 terms.Present your code to the class and explain how each tag adds meaning.
Activity: Create a one-page โAbout Meโ website that includes:
<figure> with your photo (or a placeholder) and a caption.<details> section that hides your favourite hobby (with a summary that says โClick to see my hobbyโ).<blockquote> and <cite>.Save it as about-me.html and open it in your browser.
Instructions: Build a single HTML page that is a mini recipe book for Nigerian dishes. Your page must include:
<header> with the title โMy Nigerian Recipe Bookโ.<figure> for each recipe with an image (use a placeholder) and a <figcaption>.<details> and <summary> to hide the full recipe until clicked.<details>, use a nested ordered list for the steps.<blockquote> with a famous quote about food, with a <cite>.<dl>) of at least 5 Nigerian food terms (like โEgusiโ, โJollofโ, โSuyaโ, etc.).<footer> with your name and the year.Bonus: Use <abbr> for any abbreviations (like โNGโ for Nigeria).
Assignment: Write a complete HTML page about โMy Favourite Nigerian Musicianโ. Your page should include:
<figure> with the musicianโs name and a caption.<details> section with a summary like โClick to see my favourite song lyricsโ โ and inside, a <blockquote> with the lyrics and a <cite>.<em> and <strong> at least twice each.<abbr> for at least one abbreviation.Submit your HTML file.
<figure> and <figcaption> to add captions to images and media.<details> and <summary> to create collapsible content โ it is like a magic box!<em> and <strong> add meaning; <i> and <b> are just for style.<blockquote> for long quotes and <q> for short ones.<cite> โ it shows respect.<dl>) for glossaries and word lists.type, start) help you organise complex information.<em> instead of <i> for emphasising words?<details> would be very helpful on a website?<cite> when you quote someone?<blockquote> and <q> to a younger student?<figure> makes a website better for people with disabilities?Fantastic work on Module 2! You have made your content rich and meaningful. In Module 3, we will move on to Mastering Hyperlinks & Navigation. You will learn how to:
target="_blank" and download.# links).Before you start Module 3, make sure you can:
<figure> with a <figcaption>.<details> and <summary> correctly.<em> and <i>, and between <strong> and <b>.Keep practising, and remember โ the more you code, the better you become! You are doing a brilliant job. ๐ป๐
Module 2: Advanced Text & Content Structuring • Written with ๐ for young coders in Nigeria and around the world.
Connecting your pages and guiding your visitors!
Welcome to Module 3 of your HTML Level Two journey! In Module 1, you learned how to build the modern HTML framework. In Module 2, you learned how to make your content rich and meaningful with figures, details, quotes, and lists.
Now, in Module 3, we are going to learn one of the most important things about the web: how to connect pages together. The web is called a web because everything is linked together, like a spider's web. Without links, the web would not be a web โ it would just be a collection of separate pages.
In this module, we will master the anchor tag
(<a>) โ the tag that creates hyperlinks.
We will learn about absolute paths and
relative paths โ the secret to linking files
correctly. We will explore advanced link attributes like
target="_blank" (to open links in new tabs) and
download (to let people download files).
We will also learn how to create email links,
telephone links, and page jumps
(fragment identifiers) to create a table of contents.
Think of this module as learning how to build bridges between your web pages. By the end, you will be able to create a complete, multi-page website with a proper navigation menu that works like a charm.
Let us begin our journey into the world of hyperlinks!
By the end of this module, you will be able to:
target="_blank" to open links in a new tab.download attribute to let users download files.mailto:.tel:.#).Amara was a 13-year-old girl who loved learning. Her school, Unity Academy, wanted to create a simple website to share news and information with students and parents.
Amara volunteered to help. She had learned HTML in Level One and knew how to create a single page. She made a beautiful homepage with the school logo, a welcome message, and some pictures.
But the school said, โAmara, we need more than one page! We need a page for news, a page for events, and a page for contact. And we need a navigation menu so people can move between these pages easily.โ
Amara was excited but a little nervous. She had never linked multiple pages together before. She called her big brother, who was a web developer, for help.
Her brother said, โAmara, you need to learn about hyperlinks and navigation. You need to understand paths โ how to tell your browser where to find other pages. Once you learn that, you can build a complete website with many pages, just like the big websites you see online!โ
In this module, you will learn exactly what Amara learned. You will learn how to connect pages and guide visitors through your website. Let us get started!
Definition: A hyperlink (or link) is a reference in a web page that lets you jump to another page, file, or section.
Why important: Links are the glue of the web. Without links, you would not be able to move from one page to another.
Simple explanation: A hyperlink is like a doorway in a building. You click on it, and it takes you to a different room (or a different building!).
Real-life example: In a library, you have a catalogue that tells you which shelf a book is on. That catalogue entry is like a link.
School example: Your teacher gives you a reading list. Each book title is a link to the book in the library.
Home example: Your phone contacts list โ you tap on a name, and it links you to their phone number.
Nigerian example: In a Nigerian market, a shop owner might say, โGo to the next shop for tomatoesโ โ that is like a link to the next shop.
Illustration:
Hyperlink flow:
-------------
User reads text: "Click here to see the news"
|
V
User clicks the link
|
V
Browser goes to the news page
|
V
User sees the news page! ๐
Code example:
<a href="news.html">Click here to see the news</a>
<a> Tag โ The Anchor
Definition: The <a> tag
(short for anchor) is the HTML tag used to create
hyperlinks.
Why important: It is the only tag that creates links. Without it, you cannot connect pages.
Simple explanation: The <a>
tag is like a magic rope that ties two pages
together. You hold one end, and the other end is tied to
another page.
Real-life example: A bridge connects two
islands โ the bridge is like the <a> tag.
School example: Your locker has a combination lock โ the lock is like a link that connects you to your belongings.
Home example: The remote control connects you to your TV โ it is like a link.
Nigerian example: A road connects Lagos to Ibadan โ that road is like a hyperlink.
Illustration:
<a href="destination.html">Click to go to destination</a>
| |
| +-- the destination (where you go)
+-- the link text (what you click)
Code example:
<a href="about.html">Learn more about us</a>
<a> tag
is the anchor that creates hyperlinks. It has two parts:
the href attribute (the destination) and the
link text (what you click).
href Attribute โ The Destination
Definition: The href attribute
(short for hypertext reference) tells the browser
where the link should go.
Why important: Without href,
the link does not go anywhere. It is like a door with no
room behind it.
Simple explanation: href is like
the address you write on an envelope.
It tells the postman where to deliver the letter.
Real-life example: When you send a parcel, you write the address on the box โ that is the href.
School example: You write your home address on a form โ that is like an href.
Home example: Your mum writes a shopping list with the shopโs address โ that is the href.
Nigerian example: In Nigeria, you might write โNo. 10, Lagos Roadโ โ that is an address, like an href.
Code example:
<a href="https://www.google.com">Go to Google</a>
href attribute
is the address of the destination. It tells the browser where
to go when you click the link.
Definition: An absolute path
is a full web address (URL) that includes everything โ like
https://example.com/page.html. A relative path
is a partial address that depends on where the current page is.
Why important: Relative paths make your website portable. You can move your whole website to a new server, and the links will still work.
Simple explanation: An absolute path is like giving your full home address: โNigeria, Lagos, Surulere, No. 10.โ A relative path is like saying โnext doorโ โ it only works if you are already in the same neighbourhood.
Real-life example: If you are in Lagos and you want to go to Abuja, you say โAbujaโ โ that is an absolute address. If you are in Surulere and you want to go to the shop next door, you say โnext doorโ โ that is a relative path.
School example: Your classroom number is โRoom 201โ โ that is absolute. If you are in Room 201 and you want to go to Room 202, you say โthe room next doorโ โ that is relative.
Home example: Your house number is โ12โ โ that is absolute. If you are in your house and you want to go to your neighbourโs house, you say โnext doorโ โ that is relative.
Nigerian example: In Nigeria, you might say โI live in Lagosโ โ that is absolute. If you are in Lagos and you want to go to the market, you say โthe market down the roadโ โ that is relative.
Illustration:
Absolute path:
https://example.com/folder/page.html
^^^^^^^^^^ ^^^^^^ ^^^^
full address folder file
Relative path (if current page is in the same folder):
page.html
Relative path (if current page is in the parent folder):
../page.html
Definition: A root-relative path starts with a
forward slash (/) and begins from the root folder
of your website.
Why important: It is a good way to link to pages from anywhere on your site, no matter which folder you are currently in.
Simple explanation: Think of your website as a tree. The root is the base of the tree. A root-relative path is like saying โfrom the roots, go up to the branch that has the leafโ.
Real-life example: In a large office building, the root is the ground floor. A root-relative path is like saying โfrom the ground floor, go to the 3rd floorโ.
School example: Your school has a main entrance (the root). From there, you can go to the library, the hall, or the classrooms โ that is like root-relative paths.
Home example: Your house has a front door (the root). From there, you can go to the kitchen, the bedroom, or the living room โ that is root-relative.
Nigerian example: In a Nigerian market, the main gate is the root. From there, you go to the food section, the clothing section, or the electronics section.
Illustration:
Website folder structure:
/
โโโ index.html
โโโ about.html
โโโ news/
โ โโโ latest.html
โโโ images/
โโโ logo.png
Root-relative path from index.html to latest.html:
/news/latest.html
Root-relative path from latest.html to index.html:
/index.html
/ and are always relative to the root folder of your
website. They work from any page on your site.
target="_blank" Attribute โ New Tab
Definition: target="_blank" tells
the browser to open the link in a new tab or window.
Why important: It lets visitors stay on your page while also opening another page. This is useful for links to other websites.
Simple explanation: target="_blank"
is like opening a new door while keeping the
old door open. You can go into the new room, but you can also
come back to the old room easily.
Real-life example: In a shopping mall, you might
go into a shop (your page) and then click a link to open another
shop in a new window โ that is like target="_blank".
School example: In the library, you might look at one book (your page) and then open another book (the link) next to it โ both are open at the same time.
Home example: You might be watching TV (your page) and then use your phone to check something (the new tab) โ both are happening at the same time.
Nigerian example: In a Nigerian market, you might be at one shop (your page) and then send your friend to another shop (the new tab) while you stay at the first shop.
Security Note: Always add rel="noopener noreferrer"
for security when using target="_blank".
Code example:
<a href="https://www.google.com" target="_blank" rel="noopener noreferrer">
Go to Google in a new tab
</a>
target="_blank"
opens a link in a new tab. It is useful for external links so
visitors do not leave your page.
download Attribute โ Download Files
Definition: The download attribute
tells the browser to download the linked file instead of opening it.
Why important: It lets you offer files for download โ like PDFs, images, or documents.
Simple explanation: download is
like saying โsave this to your computerโ instead of โopen this
in your browserโ.
Real-life example: When you download a song to your phone, you are โsavingโ it โ that is the download attribute.
School example: Your teacher gives you a PDF homework file โ you download it to your computer.
Home example: You download a game to your tablet โ that is a download.
Nigerian example: In Nigeria, you might download a concert poster from a website to print it.
Code example:
<a href="report.pdf" download>Download the report (PDF)</a>
download
attribute tells the browser to save the file instead of opening it.
mailto:
Definition: mailto: is a special
link that opens the userโs email program with a new message
ready to send.
Why important: It makes it easy for visitors to contact you by email.
Simple explanation: mailto: is
like having a stamped envelope ready to go.
You just click, and the email is pre-addressed.
Real-life example: On a business card, you have an email address โ that is like a mailto link.
School example: Your teacherโs email address on the notice board โ you can email them easily.
Home example: Your mumโs email address on a family group chat.
Nigerian example: A Nigerian companyโs website has a โContact Usโ link that opens an email.
Code example:
<a href="mailto:hello@mysite.com">Send me an email</a>
mailto: opens
the userโs email program with a pre-addressed message.
tel:
Definition: tel: is a special link
that lets you dial a phone number directly from a webpage.
Why important: On mobile phones, clicking a
tel: link opens the phone app and starts dialing.
Simple explanation: tel: is like
having a phone number on a webpage that you
can tap to call โ just like tapping a contact in your phone.
Real-life example: On a restaurant website, you tap the phone number to call and book a table.
School example: The schoolโs contact page has a phone number you can tap to call the office.
Home example: Your mumโs phone number on a family website โ you can tap to call her.
Nigerian example: A Nigerian business website has โCall us: 080-1234-5678โ โ you tap it to call.
Code example:
<a href="tel:+2348012345678">Call us: 080-1234-5678</a>
tel: lets you
call a phone number directly from a webpage โ perfect for
mobile users.
Definition: A fragment identifier (or anchor link)
uses # to link to a specific part of a page.
Why important: It lets you create a table of contents that jumps to different sections of a long page.
Simple explanation: A fragment identifier is like a bookmark in a book. You can jump straight to a specific chapter without flipping through all the pages.
Real-life example: In a long document, you have a table of contents. Each item in the table of contents is a link that jumps to that section.
School example: Your textbook has chapters. The table of contents lets you jump to Chapter 5 directly.
Home example: Your recipe book has an index that tells you where to find the jollof rice recipe.
Nigerian example: A Nigerian newspaper website has โTop Storiesโ โ you click and it jumps to that story.
Illustration:
Page structure:
------------
Top of page
|
V
+------------------+
| Table of Contents|
| 1. Introduction | โ click โ jumps to #intro
| 2. History | โ click โ jumps to #history
| 3. Conclusion | โ click โ jumps to #conclusion
+------------------+
|
V
+------------------+
| #intro Section | โ this is where you land
+------------------+
Code example:
<!-- Table of contents -->
<ul>
<li><a href="#intro">Introduction</a></li>
<li><a href="#history">History</a></li>
<li><a href="#conclusion">Conclusion</a></li>
</ul>
<!-- Sections with IDs -->
<section id="intro">
<h2>Introduction</h2>
<p>...</p>
</section>
<section id="history">
<h2>History</h2>
<p>...</p>
</section>
<section id="conclusion">
<h2>Conclusion</h2>
<p>...</p>
</section>
# to link to a specific part of a page. They are
perfect for tables of contents.
Definition: A table of contents is a list of links that jump to different sections of a long page.
Why important: It helps visitors navigate long pages quickly.
Simple explanation: A table of contents is like a map of your page. It shows all the main sections and lets you jump straight to the one you want.
Real-life example: A long report has a table of contents at the beginning โ you can jump to the section you need.
School example: Your textbook has a table of contents โ it shows all the chapters and their page numbers.
Home example: Your recipe book has a list of recipes โ you can jump to the page of the recipe you want.
Nigerian example: A Nigerian government document has a table of contents โ you can jump to the section you need.
Code example:
<nav>
<h2>Table of Contents</h2>
<ul>
<li><a href="#intro">Introduction</a></li>
<li><a href="#chapter1">Chapter 1: HTML Basics</a></li>
<li><a href="#chapter2">Chapter 2: Links</a></li>
<li><a href="#chapter3">Chapter 3: Media</a></li>
</ul>
</nav>
Definition: Folder organisation is how you arrange your files and folders in your website project.
Why important: Good organisation makes it easy to find files, update pages, and keep your project clean.
Simple explanation: Folder organisation is like keeping your room tidy. You put books on the shelf, clothes in the cupboard, and toys in the box. Everything has its place.
Real-life example: In a office, files are stored in labelled folders โ that is organisation.
School example: Your school bag has compartments โ one for books, one for lunch, one for stationery.
Home example: Your kitchen has a drawer for cutlery, a cupboard for plates, and a shelf for spices.
Nigerian example: In a Nigerian market, shops are grouped โ food in one area, clothes in another.
Illustration:
Good folder structure:
--------------------
my-website/
โโโ index.html
โโโ about.html
โโโ contact.html
โโโ css/
โ โโโ style.css
โโโ images/
โ โโโ logo.png
โ โโโ team.jpg
โโโ js/
โ โโโ script.js
โโโ pages/
โโโ news.html
โโโ events.html
Bad folder structure (all files in one folder):
---------------------------------------------
my-website/
โโโ index.html
โโโ about.html
โโโ contact.html
โโโ logo.png
โโโ team.jpg
โโโ style.css
โโโ script.js
โโโ news.html
โโโ events.html
Definition: A navigation menu is a set of links that appear on every page of your website, allowing visitors to move between pages.
Why important: It is the compass of your website. It helps visitors find their way around.
Simple explanation: A navigation menu is like a map that is always visible. It shows you where you are and where you can go.
Real-life example: A shopping mall has a directory map at the entrance โ that is like a navigation menu.
School example: Your school has a notice board with arrows pointing to different classrooms โ that is navigation.
Home example: Your house has doors with labels โ โKitchenโ, โBedroomโ, โBathroomโ โ that is navigation.
Nigerian example: A Nigerian bus park has signs โ โAbujaโ, โIbadanโ, โBeninโ โ that is navigation.
Code example:
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="news.html">News</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
<a>) that creates hyperlinks.https://example.com/page.html).page.html)./page.html).#section).rel="noopener noreferrer" when using target="_blank" to protect your visitors.<a href="filename.html">.</a>.<a href="folder/filename.html">.</a>.id to each section (e.g., <section id="intro">).# and the id (e.g., <a href="#intro">Introduction</a>).mailto: link.tel: link so customers can call them.mailto: links can also pre-fill the subject and body of the email? Like this: mailto:me@example.com?subject=Hello&body=Hi.tel: links work on mobile phones and in apps like WhatsApp?#section1?target="_blank" for external links, and always add rel="noopener noreferrer".href attribute โ the link will not go anywhere.page.html when the file is in a subfolder.<a> tag โ this can break the whole page.target="_blank" without rel="noopener noreferrer" โ this is a security risk.mailto: without a valid email address.mailto: and tel: for contact information โ it is user-friendly.
<nav>
+------------------------------------------+
| Home | About | News | Contact | โ each is a link
+------------------------------------------+
</nav>
Website root (/)
โโโ index.html
โโโ about.html
โโโ contact.html
โโโ news/
โ โโโ latest.html
โโโ images/
โโโ logo.png
From index.html to latest.html:
<a href="/news/latest.html">Latest News</a>
Absolute path:
https://example.com/folder/page.html
Relative path (same folder):
page.html
Relative path (subfolder):
folder/page.html
Relative path (parent folder):
../page.html
Root-relative path:
/folder/page.html
User sees Table of Contents
|
V
Clicks a link (e.g., "#chapter2")
|
V
Browser scrolls to the element with id="chapter2"
|
V
User sees the chapter ๐
| Path Type | Example | When to use |
|---|---|---|
| Absolute | https://example.com/page.html |
Linking to other websites |
| Relative (same folder) | page.html |
Linking to pages in the same folder |
| Relative (subfolder) | folder/page.html |
Linking to pages in a subfolder |
| Relative (parent folder) | ../page.html |
Linking to pages in the parent folder |
| Root-relative | /page.html |
Linking from any page to any page |
| Link Type | Example | Purpose |
|---|---|---|
| Page link | <a href="about.html">About</a> |
Go to another page |
| External link | <a href="https://google.com">Google</a> |
Go to another website |
| Email link | <a href="mailto:me@example.com">Email</a> |
Open email program |
| Phone link | <a href="tel:+2348012345678">Call</a> |
Open phone app |
| Fragment link | <a href="#section">Section</a> |
Jump to a part of the page |
| Download link | <a href="file.pdf" download>Download</a> |
Download a file |
Brilliant work, navigator! ๐งญ You have completed Module 3 of HTML Level Two.
Let us recap what you have learned:
<a> tag and its href attribute.target="_blank".download attribute.mailto: and telephone links with tel:.#).You now know how to connect pages and guide visitors through your website. Your websites are no longer just single pages โ they are full, connected experiences!
https://example.com/page.html). A relative path is a shorter address that depends on where the current page is (like page.html).target="_blank"?download attribute used for?mailto: in the href attribute โ e.g., <a href="mailto:me@example.com">Email me</a>.tel: in the href attribute โ e.g., <a href="tel:+2348012345678">Call us</a>.# to jump to a specific part of a page โ like #intro../ and ../?./ means โthe same folderโ. ../ means โthe parent folderโ (one folder up).rel="noopener noreferrer"?target="_blank". It protects your page from being hijacked.folder/page.html or a root-relative path like /folder/page.html.Match the path type on the left with its correct example on the right.
| Path Type | Example |
|---|---|
| Absolute path | A. ../about.html |
| Relative path (same folder) | B. /folder/page.html |
| Relative path (subfolder) | C. https://example.com/page.html |
| Relative path (parent folder) | D. page.html |
| Root-relative path | E. folder/page.html |
(Answers: 1-C, 2-D, 3-E, 4-A, 5-B)
Scenario 1: You are building a website for your school. You have a homepage (index.html) in the root folder, a news page (news.html) in a folder called pages, and an image (logo.png) in a folder called images.
Question: Write the correct href paths for the following links:
a) From index.html to news.html.
b) From news.html back to index.html.
c) From news.html to logo.png.
Scenario 2: You want to create a long article about โThe History of Nigerian Footballโ. You want a table of contents at the top that jumps to sections called โIntroductionโ, โEarly Yearsโ, โGolden Eraโ, and โModern Dayโ.
Question: Write the HTML code for the table of contents and the sections with the correct id attributes.
Activity: In groups of 3โ4 students, create a small website with 3 pages: index.html, about.html, and contact.html.
index.html page, add a table of contents that jumps to different sections (at least 3).contact.html page, add a mailto: link and a tel: link.images folder.Present your website to the class.
Activity: Create a one-page website about โMy Favourite Nigerian Cityโ. Include:
# for now).mailto: link to your email address.tel: link to a fake phone number.images and put a picture there).Save it as my-city.html and open it in your browser.
Instructions: Build a 4-page website for a school called โUnity Academyโ. Your pages:
index.html โ Homepage with a welcome message and a table of contents for the schoolโs history.about.html โ About page with information about the school.news.html โ News page with at least 2 news articles.contact.html โ Contact page with a mailto: link, a tel: link, and a physical address.Requirements:
index.html page, create a table of contents with at least 3 sections (e.g., โHistoryโ, โMissionโ, โVisionโ).news.html page, use fragment identifiers to jump to each article.target="_blank" for any external links.Bonus: Add a download link for a PDF brochure.
Assignment: Create a 3-page website for a fictional business of your choice (e.g., a bakery, a salon, or a tech company).
mailto: link, a tel: link, and a physical address.Requirements:
target="_blank" for at least one external link.pages, images).<a> tag with the href attribute creates links.target="_blank" opens links in a new tab โ always use rel="noopener noreferrer" for security.download lets users save files to their computer.mailto: and tel: make it easy to contact you.#) create tables of contents.Excellent work on Module 3! You are now a master of hyperlinks and navigation. In Module 4, we will dive into Media Integration. You will learn how to:
<picture> element for responsive images.srcset for resolution switching.<video> element.<audio> element.<iframe> to embed YouTube videos and maps.Before you start Module 4, make sure you can:
target="_blank".mailto: link.Keep building and exploring โ the web is your canvas! ๐จ๐
Module 3: Mastering Hyperlinks & Navigation • Written with ๐ for young coders in Nigeria and around the world.
Making your website come alive with images, videos, and audio!
Welcome to Module 4 of your HTML Level Two journey! In Module 1, you built the modern HTML framework. In Module 2, you made your content rich and meaningful. In Module 3, you mastered hyperlinks and navigation โ you learned how to connect pages and guide visitors.
Now, in Module 4, we are going to make your website come alive with media โ images, videos, and audio! A website with only text is like a movie with no sound โ it is missing something important. Media makes your website engaging, exciting, and fun.
In this module, we will learn about responsive images
using the <picture> element and srcset โ
these make your images look great on any device, from a tiny phone
to a giant TV. We will learn how to embed videos
using the <video> element, with controls and subtitles.
We will learn how to embed audio using the
<audio> element. And we will learn how to
embed external content like YouTube videos
and Google Maps using the <iframe> element.
Think of this module as adding the colour, sound, and motion to your website. By the end, you will be able to create web pages that are not just informative but also beautiful and interactive.
Let us begin our journey into the world of media!
By the end of this module, you will be able to:
<picture> element for responsive images (art direction).srcset attribute for resolution switching.loading="lazy" attribute to improve performance.<video> element with controls.<track> element.<audio> element.<iframe>.Ade was a 13-year-old boy who loved travelling. He had visited many places in Nigeria โ Lagos, Abuja, Calabar, and even the beautiful beaches in Lagos. He wanted to share his adventures with the world, so he decided to start a travel blog.
Ade wrote amazing stories about his trips. He described the sights, the sounds, and the food. But his blog looked a bit boring. It was all text โ no pictures, no videos, no music. His friends told him, โAde, your blog is good, but it needs some life!โ
Adeโs big sister, who was a web developer, said, โAde, you need to add media to your blog! Add pictures of the places you visited. Add videos of the local dances. Add audio of the sounds of the market. Your readers will love it!โ
Ade was excited. He spent the week learning about media integration. He learned how to make his images look great on phones, how to embed videos with controls, and how to add audio. By the end, his travel blog was spectacular โ it had pictures, videos, and even a podcast!
In this module, you will learn exactly what Ade learned. You will learn how to make your website come alive with media. Let us get started!
Definition: Media includes images, videos, audio, and other non-text content that makes a website more engaging.
Why important: People remember 80% of what they see, but only 20% of what they read. Media makes your website memorable and fun.
Simple explanation: Think of a movie โ you would not want to watch a movie with only text, right? Media adds colour, sound, and motion to your website.
Real-life example: A travel blog with photos of beautiful beaches is much more exciting than one with only text.
School example: A science project with diagrams and videos is more interesting than one with only words.
Home example: A family photo album is more meaningful than a list of names.
Nigerian example: A Nigerian food blog with pictures of Jollof rice and videos of cooking is much more popular.
Illustration:
Text-only page: boring ๐ด
Page with media: exciting ๐
<img> Tag โ Quick Recap
Definition: The <img> tag
is used to embed images in a webpage.
Why important: It is the simplest way to add images to your page.
Simple explanation: <img> is
like a picture frame on the wall โ it holds
the picture.
Code example:
<img src="logo.png" alt="My website logo" />
<img> is
the basic way to add images. Always include the alt
attribute for accessibility.
srcset Attribute โ Resolution Switching
Definition: srcset lets you provide
different image files for different screen sizes, so the browser
chooses the best one.
Why important: It makes your images look sharp on any device โ from a small phone to a large monitor.
Simple explanation: srcset is like
having different sizes of the same picture.
You give the browser a small picture for small screens, a medium
picture for medium screens, and a large picture for large screens.
Real-life example: A clothing store has different sizes of the same shirt โ small, medium, large. The browser chooses the right size for your device.
School example: Your teacher gives you a worksheet with different font sizes โ small for your notebook, large for the projector.
Home example: You have different sizes of the same photo on your phone โ thumbnail, medium, full-size.
Nigerian example: A Nigerian market has different sizes of bags โ small, medium, large โ you choose the one that fits your needs.
Code example:
<img
srcset="image-small.jpg 480w,
image-medium.jpg 800w,
image-large.jpg 1200w"
sizes="(max-width: 600px) 480px,
(max-width: 1000px) 800px,
1200px"
src="image-medium.jpg"
alt="A beautiful landscape"
/>
srcset lets you
provide different image files for different screen sizes.
The browser picks the best one.
<picture> Element โ Art Direction
Definition: <picture> lets you
provide different images for different situations โ like a different
crop of the same scene for mobile vs. desktop.
Why important: It lets you do art direction โ you can show a different image entirely based on the screen size, not just a smaller version.
Simple explanation: <picture>
is like having different photos of the same scene.
For a small screen, you show a close-up. For a large screen,
you show the full scene.
Real-life example: A movie poster โ on a small screen, you show just the actorโs face. On a large screen, you show the whole poster.
School example: A diagram โ on a phone, you show a simplified version. On a computer, you show the full detailed version.
Home example: A family photo โ on a phone, you show a crop of the family. On a TV, you show the full photo.
Nigerian example: A Nigerian flag โ on a small screen, you show just the green and white stripes. On a large screen, you show the full flag with the details.
Code example:
<picture>
<source media="(max-width: 600px)" srcset="landscape-small.jpg" />
<source media="(max-width: 1000px)" srcset="landscape-medium.jpg" />
<img src="landscape-large.jpg" alt="A beautiful landscape" />
</picture>
<picture>
lets you show different images based on screen size. It is
useful for art direction โ showing a different crop or scene.
loading="lazy" Attribute โ Lazy Loading
Definition: loading="lazy" tells
the browser to only load the image when the user scrolls near it.
Why important: It makes your page load faster because the browser does not load all images at once โ it only loads the ones the user can see.
Simple explanation: loading="lazy"
is like not opening all your presents at once.
You open them one by one, as you need them.
Real-life example: In a long magazine, you flip through pages โ you only look at the pictures on the pages you are reading.
School example: In a textbook, you read one page at a time โ you do not look at all the pictures at once.
Home example: You watch a movie โ you do not watch all the scenes at once; you watch one scene after another.
Nigerian example: At a Nigerian market, you look at one shop at a time โ you do not look at all the shops at once.
Code example:
<img src="large-image.jpg" alt="A large image" loading="lazy" />
loading="lazy"
makes images load only when they are about to appear on the screen.
It makes your page faster.
<video> Element โ Adding Videos
Definition: <video> is used
to embed video content in a webpage.
Why important: Videos are one of the most engaging types of media. They can explain, entertain, and inform.
Simple explanation: <video>
is like a TV screen inside your webpage.
You can play videos right on the page.
Real-life example: A cooking website has a video of the chef making Jollof rice โ you can watch it right there.
School example: A science website has a video of a volcano erupting โ you can watch it to learn.
Home example: A family website has a video of a birthday party โ you can watch the fun moments.
Nigerian example: A Nigerian music website has a video of a musician performing โ you can watch the performance.
Code example:
<video src="video.mp4" controls width="640" height="360">
Your browser does not support the video tag.
</video>
<video>
lets you embed videos on your page. Add the controls
attribute to let users play, pause, and adjust volume.
Definition: Attributes that control how the
video behaves โ like controls, autoplay,
loop, and muted.
Why important: They let you customise the video experience for your users.
Simple explanation: These attributes are like buttons on a remote control โ they let you control how the video plays.
Code example:
<video src="video.mp4" controls autoplay muted loop>
Your browser does not support the video tag.
</video>
controls adds
play/pause buttons. autoplay starts the video
automatically. muted starts it muted.
loop repeats the video.
Definition: You can provide multiple video sources (different formats) so the browser can choose one that it supports.
Why important: Different browsers support different video formats. Providing multiple sources ensures your video works for everyone.
Simple explanation: It is like having different keys for different doors. If one key does not work, you try another.
Code example:
<video controls width="640" height="360">
<source src="video.mp4" type="video/mp4" />
<source src="video.webm" type="video/webm" />
Your browser does not support the video tag.
</video>
<source>
tags inside <video> so the browser can choose
a format it supports.
<track>
Definition: <track> is used
to add subtitles, captions, or descriptions to a video.
Why important: It makes your video accessible to people who are deaf or hard of hearing, and to people who speak different languages.
Simple explanation: <track>
is like subtitles on a movie โ they show the
dialogue as text on the screen.
Code example:
<video controls>
<source src="video.mp4" type="video/mp4" />
<track src="subtitles-en.vtt" kind="subtitles" srclang="en" label="English" />
<track src="subtitles-ha.vtt" kind="subtitles" srclang="ha" label="Hausa" />
</video>
<track>
adds subtitles to videos. It makes your video accessible to
a wider audience.
<audio> Element โ Adding Audio
Definition: <audio> is used
to embed audio content in a webpage.
Why important: Audio can add atmosphere to your page โ like background music, podcasts, or sound effects.
Simple explanation: <audio>
is like a radio inside your webpage.
You can play audio right on the page.
Real-life example: A music website has a player for a song โ you can listen to it right there.
School example: A language learning website has audio for pronouncing words โ you can listen and repeat.
Home example: A family website has a recording of a grandmother telling a story.
Nigerian example: A Nigerian podcast website has audio episodes you can listen to.
Code example:
<audio controls>
<source src="audio.mp3" type="audio/mpeg" />
<source src="audio.ogg" type="audio/ogg" />
Your browser does not support the audio tag.
</audio>
<audio>
lets you embed audio on your page. Use controls
to let users play and pause.
<iframe> Element โ Embedding External Content
Definition: <iframe> (inline frame)
is used to embed another webpage or external content inside your page.
Why important: It lets you embed YouTube videos, Google Maps, social media posts, and other external content.
Simple explanation: <iframe>
is like a window into another webpage.
You can see other content right inside your page.
Real-life example: A blog embeds a YouTube video so readers can watch it without leaving the blog.
School example: A school website embeds a Google Map showing the schoolโs location.
Home example: A family website embeds a YouTube video of a family event.
Nigerian example: A Nigerian news website embeds a YouTube video of an interview with a politician.
Code example (YouTube):
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/dQw4w9WgXcQ"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowfullscreen
></iframe>
Code example (Google Map):
<iframe
src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d3964.0!2d3.0!3d6.0"
width="600"
height="450"
style="border:0;"
allowfullscreen=""
loading="lazy"
></iframe>
<iframe>
lets you embed external content like YouTube videos, Google Maps,
and social media posts.
Definition: Making sure your media is accessible to everyone, including people with disabilities.
Why important: Everyone should be able to enjoy your content, regardless of their abilities.
Simple explanation: Accessibility is like building ramps next to stairs โ it lets everyone get to the same place.
Best practices:
alt text for images.<track>.alt text, subtitles,
and transcripts.
srcset and <picture>.loading="lazy") makes your page load faster.alt text, subtitles, and transcripts ensures everyone can enjoy your media.srcset attribute to list them.sizes attribute to tell the browser when to use each.loading="lazy" attribute for performance.<video> element with controls.<source> tags for different video formats.<track> tags for subtitles.<iframe> code.<picture> to show different crops of the same image for mobile and desktop.<video> to show a chef cooking, with subtitles in multiple languages.<iframe> to embed a Google Map showing the location of a hotel.<picture> to show a close-up of Jollof rice on mobile and a full table setting on desktop.<audio> to play Afrobeats samples.<iframe> to embed a Google Map showing the school's location.<video> to show gameplay clips.<audio> to add a voice-over explaining a diagram.<iframe> to embed a YouTube video of a favourite song.<img> with srcset to show images that look good on any screen.<video> to show a birthday video.<audio> to share a recording of a family member.alt text for all images โ it is a great habit for accessibility.<picture> element was introduced in HTML5 to help with responsive images.<picture> to show different images based on the screen orientation (portrait vs landscape)?<video> can also play audio-only files, but <audio> is better for that.<iframe> can be used to embed almost any webpage โ like social media posts, Google Docs, and more?alt text for images โ it is essential for accessibility.srcset and <picture> for responsive images.loading="lazy" to make your page load faster.controls to <video> and <audio> so users can control playback.<track> โ it makes your content accessible.<iframe> to embed YouTube, maps, and other external content.alt attribute on images โ this is a big accessibility mistake.srcset โ they will load slowly on phones.controls on videos โ users cannot play or pause.autoplay without muted โ it can be annoying for users.alt text for images โ describe what the image shows.srcset and <picture> to make images responsive.loading="lazy" for images that are not immediately visible.controls to videos and audio โ users should always have control.<iframe> for embedding external content โ it is easy and works well.srcset
Browser checks screen width
|
V
Is screen < 600px? โ loads image-small.jpg
|
Is screen < 1000px? โ loads image-medium.jpg
|
Otherwise โ loads image-large.jpg
<picture> Art Direction
+----------------------------------+
| <picture> |
| <source media="(max-width:600px)" |
| srcset="close-up.jpg" /> |
| <source media="(max-width:1000px)" |
| srcset="medium.jpg" /> |
| <img src="full.jpg" alt="..." /> |
| </picture> |
+----------------------------------+
<video controls>
+----------------------------------+
| <source src="video.mp4"> |
| <source src="video.webm"> |
| <track src="subtitles.vtt"> |
| Your browser does not support |
| the video tag. |
+----------------------------------+
</video>
<iframe>
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/VIDEO_ID"
frameborder="0"
allowfullscreen
></iframe>
| Technique | What it does | Best used for |
|---|---|---|
<img> only |
Shows one image | Simple pages with one fixed image |
srcset |
Different image files for different screen sizes | Resolution switching โ same image, different sizes |
<picture> |
Different images for different situations | Art direction โ different crop or scene |
| Media Type | Element | Best used for |
|---|---|---|
| Images | <img>, <picture> |
Photos, diagrams, illustrations |
| Videos | <video> |
Movies, tutorials, animations |
| Audio | <audio> |
Music, podcasts, voice-overs |
| External content | <iframe> |
YouTube, Google Maps, social media |
Fantastic work, media master! ๐ฌ You have completed Module 4 of HTML Level Two.
Let us recap what you have learned:
srcset for resolution switching โ different sizes of the same image.<picture> for art direction โ different images for different situations.loading="lazy" for performance โ loading images only when needed.<video> and add controls, autoplay, and loop.<track>.<audio>.<iframe>.alt text, subtitles, and transcripts.You now know how to make your website come alive with images, videos, and audio. Your websites will be engaging, accessible, and memorable!
srcset and <picture>?srcset provides different sizes of the same image. <picture> allows you to show entirely different images for different situations (art direction).loading="lazy"?<track> element inside <video> with a .vtt file.<audio> for podcasts?<audio> is perfect for podcasts and other audio content.<iframe>?<iframe> (inline frame) is used to embed another webpage or external content inside your page.<iframe>?<video> element if you have the video file, but <iframe> is the easiest way to embed YouTube videos.controls attribute?srcset for resolution switching or <picture> for art direction, and include sizes to tell the browser which size to use.Match the media element on the left with its correct description on the right.
| Element/Attribute | Description |
|---|---|
srcset |
A. Provides different sizes of the same image |
<picture> |
B. Shows different images for different situations (art direction) |
loading="lazy" |
C. Loads images only when they are near the screen |
<video> |
D. Embeds video content |
<audio> |
E. Embeds audio content |
<iframe> |
F. Embeds external content like YouTube or maps |
<track> |
G. Adds subtitles to a video |
(Answers: 1-A, 2-B, 3-C, 4-D, 5-E, 6-F, 7-G)
Scenario 1: You are building a website for a Nigerian travel agency. You have a beautiful photo of Zuma Rock. You want to show a wide landscape version on desktop, a cropped version on tablet, and a close-up on mobile.
Question: Write the HTML code using <picture> to achieve this.
Scenario 2: You are creating a cooking tutorial website. You want to embed a YouTube video of a chef making Jollof rice, with a Google Map showing the chefโs restaurant location.
Question: Write the HTML code using <iframe> for both the YouTube video and the Google Map.
Activity: In groups of 3โ4 students, create a โMedia Galleryโ webpage that includes:
<picture> with different sources.<video> with controls and subtitles.<audio> with controls.<iframe> embedding a YouTube video or Google Map.Present your media gallery to the class.
Activity: Create a one-page โMy Favourite Thingsโ website that includes:
srcset (different sizes of the same image).<picture> element with different crops of the same scene.<video> with controls (use a sample video or placeholder).<audio> element with controls (use a sample audio or placeholder).<iframe> embedding a YouTube video of your favourite song.Save it as favourites.html and open it in your browser.
Instructions: Build a travel blog page for a city of your choice in Nigeria. Your page must include:
<header> with the blog title and a navigation menu.<main> section with at least 3 sections (e.g., โIntroductionโ, โAttractionsโ, โFoodโ).<picture> to show a different image for mobile, tablet, and desktop.<video> element with controls and at least two <source> formats.<audio> element with controls (e.g., a local music sample).<iframe> embedding a YouTube video of the city.<footer> with your name and the year.Bonus: Add alt text to all images and subtitles to the video using <track>.
Assignment: Create a webpage about โNigerian Musicโ that includes:
srcset.<picture> element with different crops of a concert photo.<video> with controls (use a sample video).<audio> element with controls (use a sample audio).<iframe> embedding a YouTube video of a Nigerian music video.loading="lazy" for images to improve performance.alt text to all images.Submit your HTML file.
srcset for resolution switching โ different sizes of the same image.<picture> for art direction โ different images for different situations.loading="lazy" to improve performance.<video> with controls to embed videos.<track> to add subtitles for accessibility.<audio> with controls to embed audio.<iframe> to embed external content like YouTube and maps.alt text, subtitles, and transcripts.srcset and <picture> to a friend?alt text to images?<iframe> make your website more interesting?Outstanding work on Module 4! You have made your website come alive with media. In Module 5, we will dive into HTML Forms (Intermediate Level). You will learn how to:
<label> and for attributes.<fieldset> and <legend> to group form fields.email, tel, url, number, date, and color.<select> and <optgroup>.required, pattern, min, and max.GET and POST methods.Before you start Module 5, make sure you can:
<img> with src and alt attributes.<video> with controls.<iframe> to embed a YouTube video.Keep creating and experimenting โ the web is your canvas! ๐จ๐
Module 4: Media Integration • Written with ๐ for young coders in Nigeria and around the world.
Creating interactive, user-friendly, and smart forms!
Welcome to Module 5 of your HTML Level Two journey! In Module 1, you built the modern HTML framework. In Module 2, you made your content rich and meaningful. In Module 3, you mastered hyperlinks and navigation. In Module 4, you made your website come alive with media.
Now, in Module 5, we are going to learn about one of the most important parts of any website โ forms! Forms are how websites talk to you and how you talk back. When you sign up for an account, leave a comment, or buy something online โ you are using a form.
In this module, we will learn how to create accessible forms
that everyone can use. We will use <label> to connect
text to input fields. We will group related fields with
<fieldset> and <legend>.
We will explore HTML5 input types like email,
tel, url, number, date,
and color โ these make your forms smarter and easier to use.
We will create dropdown menus with <select>
and <optgroup>. We will add client-side validation
using required, pattern, min, and
max. And we will understand the difference between
GET and POST methods for submitting forms.
Think of this module as learning how to build bridges between you and your website visitors. By the end, you will be able to create forms that are user-friendly, smart, and accessible.
Let us begin our journey into the world of forms!
By the end of this module, you will be able to:
<label> with the for attribute.<fieldset> and <legend>.email, tel, url, number, date, and color.<select> and <optgroup>.<textarea> for multi-line text input.required, pattern, min, and max.GET and POST methods.Ngozi was a 13-year-old girl who loved making crafts. She made beautiful bead necklaces, bracelets, and keychains. Her friends and family loved her work and encouraged her to sell them online.
Ngozi created a simple website to showcase her products. But she needed a way for people to order her crafts. She needed a form where customers could enter their name, email, what they wanted to order, and their address.
Ngozi had learned some basic HTML in Level One, but she had never built a real form before. Her first attempt was a mess โ the labels were not connected to the inputs, she did not know how to make a dropdown menu, and her validation did not work.
Her big brother, who was a web developer, said, โNgozi, you need to learn intermediate form techniques. You need to make your forms accessible, smart, and user-friendly. Let me teach you how.โ
In this module, you will learn exactly what Ngozi learned. You will learn how to build forms that work for everyone and make it easy for users to interact with your website. Let us get started!
Definition: A form is an HTML element that collects information from users. It is like a questionnaire or a registration form.
Why important: Forms are how websites get input from users โ like signing up, ordering products, or leaving feedback.
Simple explanation: Think of a form as a conversation starter. It asks questions (like โWhat is your name?โ) and you provide answers.
Real-life example: At school, you fill out a registration form with your name, class, and subjects.
School example: A library registration form where you write your name and student ID.
Home example: A guestbook at a wedding where guests write their names and messages.
Nigerian example: A Nigerian bank account opening form โ you fill in your name, address, and phone number.
Illustration:
User fills out form
|
V
Click "Submit"
|
V
Form data is sent to the server
|
V
Server processes the data
|
V
User sees a confirmation message ๐
<form> Element โ The Container
Definition: The <form> element
is the container for all the form fields, labels, and buttons.
Why important: It groups all the form elements together and tells the browser โthis is a formโ.
Simple explanation: The <form>
is like the folder that holds all the documents
(the inputs, labels, and buttons).
Code example:
<form action="submit.php" method="POST">
<!-- all form fields go here -->
</form>
<form> is the
container for all form elements. It holds everything together.
<label> Element โ Connecting Text to Input
Definition: <label> is used to
associate a text label with an input field using the for
attribute.
Why important: It makes your form accessible. When you click the label, the input field gets focus. Screen readers also read the label to the user.
Simple explanation: <label> is
like a name tag for an input field. It tells you
what information goes into that field.
Real-life example: In a form, you see โFull Nameโ written next to a box โ that is the label.
School example: On a test paper, each question has a label โ โQuestion 1: What is 2+2?โ โ that is a label for the answer.
Home example: On a jar, you might have a label that says โSugarโ โ that is a label for the jarโs contents.
Nigerian example: At a Nigerian market, a seller has a sign that says โTomatoesโ โ that is a label for the tomatoes.
Code example:
<label for="name">Full Name:</label>
<input type="text" id="name" name="full_name" />
<label>
connects text to an input field. It makes forms accessible and
user-friendly.
for Attribute โ The Connection
Definition: The for attribute in
<label> connects the label to an input field
by matching the inputโs id.
Why important: It creates a clear connection between the label and the input, which is essential for accessibility.
Simple explanation: The for attribute
is like a string that ties the label to the input.
Code example:
<label for="email">Email Address:</label>
<input type="email" id="email" name="user_email" />
for attribute
connects a label to an input using the inputโs id.
<fieldset> and <legend> Elements โ Grouping Fields
Definition: <fieldset> groups
related form fields together. <legend> provides
a caption for the group.
Why important: It organises your form into logical sections, making it easier to understand and use.
Simple explanation: <fieldset>
is like a box that holds related items.
<legend> is the label on the box.
Real-life example: A hospital form has sections โ โPersonal Informationโ, โMedical Historyโ, โEmergency Contactโ.
School example: A registration form has sections โ โStudent Detailsโ, โParent Detailsโ, โCourse Selectionโ.
Home example: Your familyโs address book โ sections for โFamily Membersโ, โFriendsโ, โWork Contactsโ.
Nigerian example: A Nigerian bank form has sections โ โPersonal Detailsโ, โAccount Typeโ, โNominee Informationโ.
Code example:
<fieldset>
<legend>Personal Information</legend>
<label for="name">Full Name:</label>
<input type="text" id="name" name="name" />
<label for="email">Email:</label>
<input type="email" id="email" name="email" />
</fieldset>
<fieldset>
groups related fields, and <legend> gives the
group a title.
Definition: HTML5 introduced special input types
like email, tel, and url
that help validate input and show the right keyboard on phones.
Why important: They make forms smarter and easier to use, especially on mobile devices.
Simple explanation: These input types are like
special tools for different jobs โ you use a
hammer for nails, a screwdriver for screws. Similarly, you use
email for emails, tel for phone numbers,
and url for website addresses.
Real-life example: When you sign up for a website,
you enter your email in an email field โ it checks
if it looks like an email address.
School example: A school form asks for your
parentโs phone number โ it uses tel so the phone
shows the number keypad.
Home example: A family contact list โ uses
tel for phone numbers.
Nigerian example: A Nigerian job application form
uses email for email addresses and tel
for phone numbers.
Code examples:
<label for="email">Email:</label>
<input type="email" id="email" name="email" />
<label for="phone">Phone:</label>
<input type="tel" id="phone" name="phone" />
<label for="website">Website:</label>
<input type="url" id="website" name="website" />
email, tel,
and url input types make forms smarter and help users
enter the right information.
Definition: number, date,
and color are input types for numbers, dates, and
colour selection.
Why important: They provide special controls like a calendar picker or colour picker, making it easier for users.
Simple explanation: number is like a
counter (with up/down arrows). date
is like a calendar that pops up. color
is like a colour palette you can pick from.
Real-life example: When booking a flight, you pick
a date from a calendar โ that is a date input.
School example: A science project asks for the
number of students โ you use a number input.
Home example: An online shop lets you choose the
quantity of a product โ that is a number input.
Nigerian example: A Nigerian event website lets
you pick the date of an event โ that is a date input.
Code examples:
<label for="age">Age:</label>
<input type="number" id="age" name="age" min="0" max="120" />
<label for="birthday">Birthday:</label>
<input type="date" id="birthday" name="birthday" />
<label for="favcolor">Favourite /label>
<input type="color" id="favcolor" name="favcolor" />
number, date,
and color provide special controls that make it easier
for users to enter data.
<textarea> Element โ Multi-line Text
Definition: <textarea> is used
for multi-line text input โ like a comment box or a message.
Why important: It allows users to enter longer text, like feedback, messages, or descriptions.
Simple explanation: <textarea>
is like a notepad where you can write many lines
of text.
Real-life example: On a contact form, you have a
โMessageโ box โ that is a <textarea>.
School example: A feedback form for a school event โ you write your feedback in a text area.
Home example: A family guestbook โ you write a message in a text area.
Nigerian example: A Nigerian bank complaint form โ you write your complaint in a text area.
Code example:
<label for="message">Your Message:</label>
<textarea id="message" name="message" rows="5" cols="50"></textarea>
<textarea>
allows users to enter multi-line text โ perfect for messages,
comments, and feedback.
<select> Element โ Dropdown Menus
Definition: <select> creates
a dropdown menu where users can choose one option from a list.
Why important: It saves space and helps users choose from a list of options, reducing errors.
Simple explanation: <select>
is like a menu at a restaurant. You look at the
list and choose one item.
Real-life example: On a flight booking form, you select your country from a dropdown menu.
School example: A school form asks for your class โ you select it from a dropdown.
Home example: An online shop asks for your state โ you select it from a dropdown.
Nigerian example: A Nigerian form asks for your state of origin โ you select it from a dropdown.
Code example:
<label for="state">State of Origin:</label>
<select id="state" name="state">
<option value="">-- Select your state --</option>
<option value="lagos">Lagos</option>
<option value="abuja">Abuja</option>
<option value="kano">Kano</option>
<option value="rivers">Rivers</option>
</select>
<select>
creates a dropdown menu. It is perfect for lists of options.
<optgroup> Element โ Grouping Options
Definition: <optgroup> groups
related options inside a <select> dropdown.
Why important: It makes long dropdown menus easier to navigate by grouping similar options together.
Simple explanation: <optgroup>
is like sections in a restaurant menu โ โAppetizersโ,
โMain Coursesโ, โDessertsโ.
Real-life example: A form for selecting a country might group countries by continent โ โAfricaโ, โEuropeโ, โAsiaโ.
School example: A form for selecting a subject might group subjects by category โ โSciencesโ, โArtsโ, โLanguagesโ.
Home example: An online shop might group products by category โ โElectronicsโ, โClothingโ, โBooksโ.
Nigerian example: A Nigerian form might group states by geopolitical zone โ โSouth-Westโ, โSouth-Eastโ, โNorth-Centralโ.
Code example:
<label for="region">Geopolitical Zone:</label>
<select id="region" name="region">
<optgroup label="South-West">
<option value="lagos">Lagos</option>
<option value="ogun">Ogun</option>
<option value="oyo">Oyo</option>
</optgroup>
<optgroup label="South-East">
<option value="enugu">Enugu</option>
<option value="imo">Imo</option>
<option value="abia">Abia</option>
</optgroup>
<optgroup label="North-Central">
<option value="abuja">Abuja</option>
<option value="plateau">Plateau</option>
<option value="niger">Niger</option>
</optgroup>
</select>
<optgroup>
groups related options in a dropdown menu, making it easier to
navigate.
required
Definition: The required attribute
makes a field mandatory โ the user cannot submit the form without
filling it in.
Why important: It ensures that users provide important information before submitting the form.
Simple explanation: required is like
a teacher saying โYou must answer this question
before you can submit your test.โ
Real-life example: When signing up for a website, the email and password fields are usually required.
School example: A test paper has a required question โ you must answer it.
Home example: A shopping list has required items โ you must buy them.
Nigerian example: A Nigerian bank form has required fields โ you must fill in your name and phone number.
Code example:
<label for="name">Full Name (required):</label>
<input type="text" id="name" name="name" required />
required makes a
field mandatory. Users cannot submit the form without filling it in.
pattern
Definition: The pattern attribute
uses a regular expression to validate the input โ it checks if
the input matches a specific pattern.
Why important: It ensures that users enter data in the correct format โ like a phone number or a postal code.
Simple explanation: pattern is like
a rule that says โYour answer must look like thisโ.
Real-life example: A form for a postal code might use a pattern to ensure it is a 5-digit number.
School example: A math test asks for a number between 1 and 10 โ that is a pattern.
Home example: A password field might require at least one special character โ that is a pattern.
Nigerian example: A Nigerian phone number field
might use a pattern to ensure it starts with 0 and
has 11 digits.
Code example:
<label for="phone">Phone Number (e.g., 080-1234-5678):</label>
<input type="tel" id="phone" name="phone"
pattern="[0-9]{3}-[0-9]{4}-[0-9]{4}"
placeholder="080-1234-5678" />
pattern validates
input against a specific pattern, ensuring users enter data in
the right format.
min and max
Definition: min and max
set the minimum and maximum values for number and
date inputs.
Why important: They ensure that users enter values within an acceptable range.
Simple explanation: min and max
are like speed limits โ you cannot go below the
minimum or above the maximum.
Real-life example: A form for age might have
min="18" and max="100".
School example: A test score input might have
min="0" and max="100".
Home example: A quantity input might have
min="1" and max="10".
Nigerian example: A Nigerian bank form for
age might have min="18" and max="100".
Code example:
<label for="age">Age (18-100):</label>
<input type="number" id="age" name="age" min="18" max="100" />
min and max
set limits on numeric and date inputs, ensuring values are within
a valid range.
GET vs POST โ Sending Form Data
Definition: GET and POST
are two methods for sending form data to the server.
Why important: They determine how the form data
is transmitted โ GET appends it to the URL,
POST sends it in the background.
Simple explanation: GET is like
shouting your answer so everyone can hear.
POST is like whispering โ it is
more private.
Real-life example: When you search on Google,
the search term appears in the URL โ that is GET.
When you log in to a website, your password is sent using
POST โ it is not visible in the URL.
School example: A public exam โ the questions
are visible (like GET). A private conversation with
the teacher is private (like POST).
Home example: A shopping list on the fridge โ
everyone can see it (like GET). A private note in
your room โ only you can see it (like POST).
Nigerian example: In a Nigerian market, you might
ask โHow much is this?โ loudly โ that is like GET.
You might whisper your budget to the seller โ that is like
POST.
Comparison table:
| Feature | GET |
POST |
|---|---|---|
| Data visibility | Visible in the URL | Not visible in the URL |
| Bookmarking | Can be bookmarked | Cannot be bookmarked |
| Data length | Limited (about 2000 characters) | No limit (can send files) |
| Security | Less secure (data is visible) | More secure (data is hidden) |
| Best for | Search forms, filters | Login, registration, file upload |
GET sends data in
the URL (visible). POST sends data in the background
(hidden). Use POST for sensitive data.
for attributes make forms usable by everyone, including people using screen readers.fieldset and using the right input types makes forms easier to use.required, pattern, etc.) helps users fill in forms correctly.POST for sensitive data like passwords and personal information.<form> and add action and method.<fieldset> with a <legend>.<label> with for and an <input> with id.type for each input (email, tel, etc.).<textarea> for the message.<button type="submit"> to submit the form.required to fields that must be filled.pattern to fields that need a specific format.min and max to numeric fields.<label> with for attributes โ it is a sign of a good developer.GET and POST by using everyday examples like shouting vs. whispering.email, tel, and date in 2014.required attribute is supported by all modern browsers.GET requests are limited to about 2000 characters, but POST requests can handle much more data.pattern to validate Nigerian phone numbers? The pattern [0-9]{11} ensures it has 11 digits.<fieldset> and <legend> are perfect for grouping related fields โ like โPersonal Informationโ and โContact Detailsโ.color input type lets users pick a colour from a palette โ it is great for design forms!<label> with for for accessibility.<fieldset> and <legend> to group related fields.email, tel, number, etc.required for mandatory fields.pattern for format validation.POST for sensitive data and GET for search forms.for attribute on <label> โ this breaks accessibility.GET for forms with sensitive data like passwords.required on mandatory fields โ users can submit empty forms.text for emails.<form> tag.<label> with for โ it is essential for accessibility.<fieldset> and <legend>.required, pattern, and min/max.POST for sensitive data and GET for search forms.
<form>
+------------------------------------------+
| <fieldset> |
| <legend>Personal Information</legend>|
| +----------------------------------+ |
| | <label for="name">Name:</label> | |
| | <input type="text" id="name" /> | |
| | <label for="email">Email:</label>| |
| | <input type="email" id="email"> | |
| +----------------------------------+ |
| </fieldset> |
| <button type="submit">Submit</button> |
+------------------------------------------+
</form>
GET:
Form data โ appended to URL โ visible to everyone
POST:
Form data โ sent in the background โ hidden from view
User fills out form
|
V
User clicks Submit
|
V
Browser checks validation
|
+----------------------+
| All fields valid? |
+----------------------+
| Yes | No
V V
Form is sent Form stays on page
to server with error messages
| Input Type | Best used for | Example |
|---|---|---|
text |
General text | Name, address |
email |
Email addresses | user@example.com |
tel |
Phone numbers | 080-1234-5678 |
url |
Website addresses | https://example.com |
number |
Numbers | Age, quantity |
date |
Dates | 2025-12-25 |
color |
Colour selection | #ff0000 (red) |
| Feature | GET |
POST |
|---|---|---|
| Data visibility | Visible in URL | Hidden |
| Can be bookmarked | Yes | No |
| Data length limit | ~2000 characters | No limit |
| Security | Less secure | More secure |
| Best for | Search, filters | Login, registration, file upload |
Brilliant work, form builder! ๐ You have completed Module 5 of HTML Level Two.
Let us recap what you have learned:
<label> with the for attribute for accessibility.<fieldset> and <legend>.email, tel, url, number, date, and color.<select> and group options with <optgroup>.<textarea> for multi-line text input.required, pattern, min, and max.GET and POST methods and when to use each.You now know how to build user-friendly, accessible, and smart forms that can collect information from your website visitors. Your forms will be easy to use, work for everyone, and help you interact with your audience.
<label> and just plain text?<label> connects to the input using the for attribute. When you click the label, the input gets focus. It also helps screen readers.<fieldset>?pattern attribute used for?GET and POST?GET sends data in the URL (visible). POST sends data in the background (hidden). Use POST for sensitive data.required on any input type?required works on most input types, including text, email, number, and even checkboxes.id attribute used for?id attribute uniquely identifies an element. It is used by <label for="..."> to connect the label to the input.<textarea> for a single line of text?<input type="text"> for single-line text.placeholder attribute do?required attribute. All fields are optional by default.GET for a login form?POST for login forms.Match the form element on the left with its correct description on the right.
| Element | Description |
|---|---|
<label> |
A. Groups related form fields |
for |
B. Connects a label to an input |
<fieldset> |
C. Multi-line text input |
<legend> |
D. A dropdown menu |
<textarea> |
E. A caption for a fieldset |
<select> |
F. A label for an input |
required |
G. Makes a field mandatory |
(Answers: 1-F, 2-B, 3-A, 4-E, 5-C, 6-D, 7-G)
Scenario 1: You are building a registration form for a school club. The form needs fields for: full name (text), email (email), phone number (tel), date of birth (date), and a dropdown for class (JS1, SS1, etc.).
Question: Write the HTML code for this form, including <fieldset>, <label>, and the right input types.
Scenario 2: You are building a contact form for a Nigerian business. The form needs fields for: full name (required), email (required), phone number (with a pattern for Nigerian numbers), and a message (textarea).
Question: Write the HTML code with validation (required, pattern).
Activity: In groups of 3โ4 students, design a form for a Nigerian event (like a wedding, a festival, or a concert). Your form should include:
<fieldset> for "Personal Information" (name, email, phone).<fieldset> for "Event Details" (dropdown for event type, date, number of guests).<textarea> for special requests.required, pattern, min/max).Present your form to the class.
Activity: Create a "My Profile" form with the following fields:
<optgroup> grouped by geopolitical zones).Save it as profile.html and open it in your browser.
Instructions: Build an order form for a fictional online shop. Your form must include:
<fieldset> for "Customer Information" (name, email, phone).<fieldset> for "Order Details" โ a dropdown for product (with <optgroup> categories), a number input for quantity, and a date for delivery.<fieldset> for "Delivery Address" (street, city, state dropdown).<textarea> for special instructions.required on name, email, and phone. pattern for phone number. min and max for quantity.POST method.Bonus: Add a color input for choosing a product colour.
Assignment: Create a "School Registration Form" for a fictional school called "Unity Academy". The form should include:
<fieldset> and <legend> to group the sections.POST method.Submit your HTML file.
<label> with for for accessibility.<fieldset> and <legend> to group related fields.email, tel, number, etc. โ to make forms smarter.required, pattern, and min/max for validation.POST for sensitive data and GET for search forms.GET and POST to a 10-year-old?Outstanding work on Module 5! You are now a master of building forms. In Module 6, we will dive into Tables (Beyond Basic Grids). You will learn how to:
<thead>, <tbody>, and <tfoot> to structure tables.colspan and rowspan to merge cells.<th> with scope for accessible tables.caption and aria-label for complex data tables.Before you start Module 6, make sure you can:
<table>, <tr>, and <td>.<label> with for in forms.GET and POST.Keep building and experimenting โ every form you create is a step towards becoming a great developer! ๐ป๐
Module 5: HTML Forms (Intermediate Level) • Written with ๐ for young coders in Nigeria and around the world.
Organising data like a pro โ with structure, meaning, and accessibility!
Welcome to Module 6 of your HTML Level Two journey! In Module 1, you built the modern HTML framework. In Module 2, you made your content rich and meaningful. In Module 3, you mastered hyperlinks and navigation. In Module 4, you made your website come alive with media. In Module 5, you built smart, accessible forms.
Now, in Module 6, we are going to dive deep into tables. In Level One, you learned the basics โ how to create a simple table with rows and columns. But now we are going to take it to the next level!
In this module, we will learn how to structure tables properly
using <thead>, <tbody>,
and <tfoot>. We will learn how to merge cells
using colspan and rowspan โ this lets
you create complex tables like calendars and timetables.
We will learn how to make tables accessible for
screen readers using scope, caption,
and aria-label. And we will build real-world tables
like price charts, class timetables, and data reports.
Think of this module as learning how to build a proper filing system for your data. By the end, you will be able to create tables that are clear, meaningful, and accessible to everyone.
Let us begin our journey into the world of advanced tables!
By the end of this module, you will be able to:
<thead>, <tbody>, and <tfoot>.colspan.rowspan.<th> with the scope attribute for accessible tables.caption to a table.aria-label for complex data tables.Chidi was a 13-year-old boy who loved football. He was the captain of his schoolโs football team, the Lagos Lions. He wanted to keep track of all the matches, goals, and points for the league season.
Chidi created a simple table in HTML. It had rows and columns, and it showed the team names, matches played, and points. But the table was messy โ it was hard to read, and it did not look professional.
Chidiโs big sister, who was a web developer, said, โChidi, you need to learn advanced table techniques. You need to structure your table properly with a header, body, and footer. You need to merge cells for better organisation. And you need to make it accessible so that everyone can understand it.โ
Chidi spent the weekend learning about advanced tables.
He learned how to use <thead>, <tbody>,
and <tfoot>. He learned how to merge cells with
colspan and rowspan. And he learned how
to make his tables accessible with scope and
caption. By the end, his league table was
clean, organised, and professional โ just like
the tables you see on the BBC Sport website!
In this module, you will learn exactly what Chidi learned. You will learn how to build proper, structured, and accessible tables that can handle any type of data. Let us get started!
Definition: A table is a way to organise data in rows and columns โ like a spreadsheet.
Why important: Tables are perfect for displaying structured data โ like schedules, price lists, statistics, and comparison charts.
Simple explanation: A table is like a grid of information. It is like a spreadsheet where you put data in boxes.
Real-life example: A train timetable โ it shows departure times, arrival times, and platforms in a table.
School example: Your class timetable โ it shows subjects for each day and period.
Home example: A shopping list โ you might have columns for โItemโ, โQuantityโ, and โPriceโ.
Nigerian example: A Nigerian market price list โ it shows items and their prices in a table.
Illustration:
Table structure:
+------------------+------------------+
| Header 1 | Header 2 | โ header row
+------------------+------------------+
| Data 1 | Data 2 | โ data rows
| Data 3 | Data 4 |
+------------------+------------------+
<table>, <tr>, <td>, <th>
Definition: <table> is the
container. <tr> is a row. <td>
is a cell (data). <th> is a header cell.
Why important: These are the building blocks of every table. Without them, you cannot create a table.
Simple explanation: <table>
is the grid. <tr> is a
row (like a line of boxes). <td>
is a box that holds data. <th>
is a special box for headings.
Code example:
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Ade</td>
<td>13</td>
</tr>
<tr>
<td>Bola</td>
<td>14</td>
</tr>
</table>
<table>
holds the table. <tr> makes rows.
<td> holds data. <th>
holds headings.
<thead> Element โ The Table Header
Definition: <thead> groups
the header rows of a table.
Why important: It tells the browser (and screen readers) that these rows are the tableโs header.
Simple explanation: <thead>
is like the title row of your table โ it tells
you what each column is about.
Code example:
<table>
<thead>
<tr>
<th>Product</th>
<th>Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Jollof Rice</td>
<td>โฆ5,000</td>
</tr>
</tbody>
</table>
<thead>
groups the header rows of a table. It makes the table structure
clearer.
<tbody> Element โ The Table Body
Definition: <tbody> groups
the main data rows of a table.
Why important: It separates the main data from the header and footer, making the table easier to read and style.
Simple explanation: <tbody>
is the main content of your table โ it holds
all the data.
Code example:
<table>
<thead>
<tr><th>Name</th><th>Age</th></tr>
</thead>
<tbody>
<tr><td>Ade</td><td>13</td></tr>
<tr><td>Bola</td><td>14</td></tr>
</tbody>
</table>
<tbody>
holds the main data rows of a table.
<tfoot> Element โ The Table Footer
Definition: <tfoot> groups
the footer rows of a table โ like totals or summaries.
Why important: It lets you add summary information at the bottom of the table, like total scores or averages.
Simple explanation: <tfoot>
is like the summary row at the bottom of a
spreadsheet โ it shows totals or conclusions.
Code example:
<table>
<thead>
<tr><th>Item</th><th>Price</th></tr>
</thead>
<tbody>
<tr><td>Rice</td><td>โฆ5,000</td></tr>
<tr><td>Beans</td><td>โฆ3,000</td></tr>
</tbody>
<tfoot>
<tr><td>Total</td><td>โฆ8,000</td></tr>
</tfoot>
</table>
<tfoot>
holds summary information at the bottom of a table.
colspan Attribute โ Merging Columns
Definition: colspan lets a cell
span across multiple columns โ it merges them horizontally.
Why important: It lets you create more complex table layouts โ like a header that stretches across the whole table.
Simple explanation: colspan is like
pushing two boxes together to make one big box
that is twice as wide.
Real-life example: A calendar โ the day โMondayโ might span across 2 columns if there is a holiday.
School example: A timetable โ โBreakโ might span across 2 periods.
Home example: A shopping list โ a section header like โProduceโ might span across 3 columns.
Nigerian example: A Nigerian market price list โ a category like โFoodstuffsโ might span across several columns.
Illustration:
Before (2 columns):
+------------+------------+
| A | B |
+------------+------------+
After (colspan="2"):
+-------------------------+
| A (spans 2 columns) |
+-------------------------+
Code example:
<table>
<tr>
<th colspan="3">Student Information</th>
</tr>
<tr>
<th>Name</th>
<th>Age</th>
<th>Class</th>
</tr>
<tr>
<td>Ade</td>
<td>13</td>
<td>JS2</td>
</tr>
</table>
colspan merges
cells horizontally โ it makes a cell span across multiple columns.
rowspan Attribute โ Merging Rows
Definition: rowspan lets a cell
span across multiple rows โ it merges them vertically.
Why important: It lets you create more complex table layouts โ like a cell that spans down several rows.
Simple explanation: rowspan is like
pushing two boxes on top of each other to make
one tall box.
Real-life example: A calendar โ a holiday that lasts for 3 days might span 3 rows.
School example: A timetable โ a subject that runs for 2 consecutive periods might span 2 rows.
Home example: A shopping list โ a category like โProduceโ might span 3 rows for different items.
Nigerian example: A Nigerian market price list โ a shop name might span several rows for different products.
Illustration:
Before (2 rows):
+------------+
| A |
+------------+
| B |
+------------+
After (rowspan="2"):
+------------+
| A (spans |
| 2 rows) |
+------------+
Code example:
<table>
<tr>
<th rowspan="2">Student</th>
<th>Subject 1</th>
<th>Subject 2</th>
</tr>
<tr>
<td>Maths</td>
<td>English</td>
</tr>
</table>
rowspan merges
cells vertically โ it makes a cell span across multiple rows.
scope Attribute โ Accessibility for Headers
Definition: scope tells screen
readers whether a header applies to a column, a row, or a group.
Why important: It helps screen readers understand the relationship between headers and data cells, making tables accessible to people with visual impairments.
Simple explanation: scope is like
signs that tell you which direction a header
points โ it is for a column, a row, or a group.
Real-life example: In a classroom, the teacher
says โThis column is for Maths, this row is for Mondayโ โ the
scope attribute does the same for screen readers.
School example: A timetable โ the subject names
in the first row have scope="col", and the days
in the first column have scope="row".
Home example: A family budget โ the categories
have scope="col" and the months have
scope="row".
Nigerian example: A Nigerian market price list โ
the items have scope="col" and the shops have
scope="row".
Code example:
<table>
<thead>
<tr>
<th scope="col">Name</th>
<th scope="col">Age</th>
<th scope="col">Class</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Ade</th>
<td>13</td>
<td>JS2</td>
</tr>
</tbody>
</table>
scope tells
screen readers whether a header applies to a column
(scope="col") or a row (scope="row").
caption Element โ Table Title
Definition: <caption> provides
a title or description for the table.
Why important: It tells users (and screen readers) what the table is about โ like a title at the top of a page.
Simple explanation: <caption>
is like the title on a book โ it tells you what
the table is about.
Real-life example: A newspaper has a headline above a table โ that is like a caption.
School example: A science project has a title above a data table โ that is a caption.
Home example: A family budget sheet has a title like โMonthly Expensesโ โ that is a caption.
Nigerian example: A Nigerian bank statement has a title like โAccount Summaryโ โ that is a caption.
Code example:
<table>
<caption>Class Timetable for JS2</caption>
<thead>
<tr>
<th>Day</th>
<th>Period 1</th>
<th>Period 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Monday</td>
<td>Maths</td>
<td>English</td>
</tr>
</tbody>
</table>
<caption>
adds a title to your table. It tells everyone what the table is about.
aria-label โ Describing Complex Tables
Definition: aria-label is an
accessibility attribute that provides a label for the table
when a <caption> is not enough.
Why important: It provides additional context for screen readers, especially for complex or data-heavy tables.
Simple explanation: aria-label
is like extra information that only screen
readers can see โ it helps people understand the table better.
Code example:
<table aria-label="League standings for the 2026 season">
<thead>
<tr>
<th scope="col">Team</th>
<th scope="col">Matches</th>
<th scope="col">Points</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Lagos Lions</th>
<td>10</td>
<td>25</td>
</tr>
</tbody>
</table>
aria-label
provides an extra description for screen readers, especially
for complex tables.
Definition: A price comparison table compares prices of different products or services.
Why important: It helps users make informed decisions by comparing options side by side.
Simple explanation: A price comparison table is like shopping around โ you see different prices in one place and choose the best one.
Real-life example: A website that compares phone plans from different networks.
School example: A student comparing prices of different school supplies.
Home example: A family comparing prices of different internet packages.
Nigerian example: A Nigerian e-commerce site comparing prices of the same phone across different sellers.
Code example:
<table>
<caption>Price Comparison โ Data Plans</caption>
<thead>
<tr>
<th scope="col">Network</th>
<th scope="col">Data (GB)</th>
<th scope="col">Price (โฆ)</th>
<th scope="col">Validity (Days)</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">MTN</th>
<td>5</td>
<td>2,500</td>
<td>30</td>
</tr>
<tr>
<th scope="row">Airtel</th>
<td>5</td>
<td>2,200</td>
<td>30</td>
</tr>
<tr>
<th scope="row">Glo</th>
<td>5</td>
<td>2,000</td>
<td>30</td>
</tr>
</tbody>
</table>
Definition: A class timetable shows which subjects are taught on each day and period.
Why important: It helps students and teachers know where to be and when.
Simple explanation: A timetable is like a map of your school week โ it shows you where to go and when.
Real-life example: A university timetable showing lectures, tutorials, and labs.
School example: Your own class timetable with subjects for each day.
Home example: A family weekly planner โ it shows who is doing what on each day.
Nigerian example: A Nigerian schoolโs timetable โ it shows subjects like Maths, English, and Social Studies.
Code example:
<table>
<caption>JS2 Class Timetable</caption>
<thead>
<tr>
<th scope="col">Day</th>
<th scope="col">Period 1</th>
<th scope="col">Period 2</th>
<th scope="col">Period 3</th>
<th scope="col">Period 4</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">Monday</th>
<td>Maths</td>
<td>English</td>
<td>Science</td>
<td>History</td>
</tr>
<tr>
<th scope="row">Tuesday</th>
<td>English</td>
<td>Maths</td>
<td>Art</td>
<td>Music</td>
</tr>
<tr>
<th scope="row">Wednesday</th>
<td colspan="4">Sports Day! ๐</td>
</tr>
</tbody>
</table>
<tr>).<td>).<th>).<thead>, <tbody>, and <tfoot> to organise your table.scope, caption, and aria-label to make your tables usable by everyone.colspan and rowspan to create complex table layouts like calendars and timetables.caption to explain what the table shows.<table>.<caption> with a title.<thead> with <th> headers.<tbody> with <td> data cells.<tfoot> with summary information (if needed).</table>.<td> or <th>, add colspan="X" to span X columns.<td> or <th>, add rowspan="Y" to span Y rows.<caption> for every table โ it is a good habit.scope attribute was introduced to improve accessibility for tables.colspan and rowspan can be used together to create very complex table layouts?aria-label is part of the ARIA (Accessible Rich Internet Applications) specification?<thead>, <tbody>, and <tfoot> for structure.scope to make tables accessible.caption to explain what the table is about.colspan and rowspan to merge cells.aria-label for complex tables.<tr> or <td> tags โ this can break the table.<th> without scope โ this hurts accessibility.<thead> and <tbody> โ this makes the table unstructured.colspan and rowspan โ it can mess up the layout.caption โ users might not know what the table is about.<thead>, <tbody>, and <tfoot>.scope="col" or scope="row" to <th>.caption to explain the table.colspan and rowspan sparingly โ only when necessary.
+------------------------------------------+
| <caption>Table Title</caption> |
+------------------------------------------+
| <thead> |
| +------------+------------+ |
| | Header 1 | Header 2 | |
| +------------+------------+ |
| </thead> |
+------------------------------------------+
| <tbody> |
| +------------+------------+ |
| | Data 1 | Data 2 | |
| | Data 3 | Data 4 | |
| +------------+------------+ |
| </tbody> |
+------------------------------------------+
| <tfoot> |
| +------------+------------+ |
| | Total 1 | Total 2 | |
| +------------+------------+ |
| </tfoot> |
+------------------------------------------+
colspan (horizontal merge):
+-------------------------+
| A (spans 2 columns) |
+------------+------------+
| B | C |
+------------+------------+
rowspan (vertical merge):
+------------+------------+
| A (spans | B |
| 2 rows) +------------+
| | C |
+------------+------------+
+------------------+------------------+
| <th scope="col">Name</th> |
| <th scope="col">Age</th> |
+------------------+------------------+
| <th scope="row">Ade</th> |
| <td>13</td> |
+------------------+------------------+
| <th scope="row">Bola</th> |
| <td>14</td> |
+------------------+------------------+
| Element | Purpose | Example |
|---|---|---|
<table> |
Container for the table | <table>...</table> |
<tr> |
Defines a row | <tr><td>Data</td></tr> |
<td> |
Defines a data cell | <td>Text</td> |
<th> |
Defines a header cell | <th>Header</th> |
<thead> |
Groups header rows | <thead>...</thead> |
<tbody> |
Groups data rows | <tbody>...</tbody> |
<tfoot> |
Groups footer rows | <tfoot>...</tfoot> |
colspan |
Merges cells horizontally | colspan="2" |
rowspan |
Merges cells vertically | rowspan="2" |
scope |
Accessibility for headers | scope="col" |
| Feature | Purpose | When to use |
|---|---|---|
scope |
Associates headers with data cells | All tables with headers |
<caption> |
Provides a title for the table | All tables |
aria-label |
Provides extra description | Complex or data-heavy tables |
Fantastic work, table master! ๐ You have completed Module 6 of HTML Level Two.
Let us recap what you have learned:
<thead>, <tbody>, and <tfoot> for structure.colspan and rowspan.scope to make tables accessible for screen readers.caption to explain what the table is about.aria-label for complex tables.You now know how to build structured, clear, and accessible tables that can handle any type of data. Your tables will be easy to read, understand, and use by everyone.
<thead>, <tbody>, and <tfoot>?colspan and rowspan?colspan merges cells horizontally (across columns). rowspan merges cells vertically (across rows).scope used for?scope="col") or a row (scope="row").caption to my table?aria-label used for?colspan and rowspan together?<th> and <td>?<th> is for headers (labels). <td> is for data (values).<td> or <th>.Match the table element on the left with its correct description on the right.
| Element | Description |
|---|---|
<thead> |
A. Merges cells horizontally |
<tbody> |
B. Merges cells vertically |
<tfoot> |
C. Groups header rows |
colspan |
D. Groups data rows |
rowspan |
E. Groups footer rows |
scope |
F. Provides a title for the table |
<caption> |
G. Associates headers with data cells |
(Answers: 1-C, 2-D, 3-E, 4-A, 5-B, 6-G, 7-F)
Scenario 1: You are building a price comparison website for Nigerian data plans. You want to compare MTN, Airtel, and Glo. The table should show the network name, data in GB, price, and validity in days.
Question: Write the HTML code for this table, including <thead>, <tbody>, scope, and a caption.
Scenario 2: You are building a class timetable for JS3. The timetable has 5 days (MondayโFriday) and 4 periods per day. On Wednesday, there is a sports event that takes up the whole morning (2 periods).
Question: Write the HTML code for this timetable, using colspan to merge the sports event across 2 periods.
Activity: In groups of 3โ4 students, choose a topic and create a data table. Some ideas:
Your table must include:
<thead>, <tbody>, and <tfoot>.scope for accessibility.caption.colspan or rowspan.Present your table to the class.
Activity: Create a table showing the "Top 10 Nigerian Football Clubs". Include columns for:
Use <thead>, <tbody>, scope, and a caption. Add a <tfoot> with a summary (e.g., "Total clubs listed: 10").
Save it as clubs.html and open it in your browser.
Instructions: Build a price comparison table for a Nigerian market. Your table should compare prices of 5 common food items (e.g., Rice, Beans, Garri, Oil, Salt) across 3 different shops.
Requirements:
<thead> for the shop names (as column headers).<tbody> for the food items and prices.scope on all headers.caption explaining the table.colspan to create a header that says "Market Price Comparison".<tfoot> with the total cost for each shop.Bonus: Add an aria-label for extra accessibility.
Assignment: Create a "School Report Card" table for 5 students. The table should include:
<tfoot> for the total).caption explaining the report card.scope on all headers.colspan to merge the "Subjects" header across all subjects.Submit your HTML file.
<thead>, <tbody>, and <tfoot> for structure.colspan and rowspan to merge cells.scope to make tables accessible for screen readers.caption to explain what the table is about.aria-label for complex tables.scope in tables?colspan and rowspan to a 10-year-old?<tfoot> instead of just adding a row at the bottom?caption important for a table?Excellent work on Module 6! You are now a master of building structured and accessible tables. In Module 7, we will dive into Accessibility, SEO, and Best Practices. You will learn how to:
role="main") to help screen readers.lang attribute correctly.Before you start Module 7, make sure you can:
<thead>, <tbody>, and <tfoot>.colspan and rowspan to merge cells.scope and a caption to a table.Keep learning and experimenting โ every table you build is a step towards becoming a great developer! ๐ป๐
Module 6: Tables (Beyond Basic Grids) • Written with ๐ for young coders in Nigeria and around the world.
Building websites that work for everyone โ and rank high on Google!
Welcome to Module 7 โ the final module of your HTML Level Two journey! In the previous six modules, you learned how to build the modern HTML framework, make your content rich and meaningful, master hyperlinks, add media, build forms, and create structured tables. You have come a long way!
Now, in Module 7, we are going to bring everything together and learn about the most important qualities of a great website: Accessibility, SEO, and Best Practices.
Accessibility means making your website usable by everyone, including people with disabilities โ like people who cannot see well or cannot use a mouse. SEO (Search Engine Optimisation) means helping search engines like Google find and understand your page, so people can find it when they search. Best Practices are the rules that good developers follow to write clean, reliable code.
Think of this module as polishing your masterpiece. You have built a beautiful website โ now we are going to make it shine for everyone and be easy to find.
Let us begin our final journey!
By the end of this module, you will be able to:
role="main") to help screen readers.h1 to h6) for SEO and accessibility.lang attribute correctly.Ade was a 13-year-old boy who loved building websites. He had just finished creating a beautiful website for his school, Unity Academy. It had a homepage, a news page, a contact form, and even a gallery of photos. He was very proud of his work.
But one day, his teacher said, โAde, I cannot read your website.โ Ade was confused. โWhy not?โ he asked. โBecause I am blind,โ the teacher replied. โI use a screen reader to read web pages. Your website does not work with my screen reader.โ
Ade was shocked. He had never thought about people with disabilities. He also noticed that his website was not showing up on Google when he searched for it. His friends could not find it!
Adeโs big sister, who was a web developer, said, โAde, you need to learn about accessibility and SEO. You need to make your website work for everyone โ including people with disabilities โ and make it easy to find on Google. Let me teach you the best practices.โ
In this module, you will learn exactly what Ade learned. You will learn how to make your website accessible, discoverable, and polished. Let us get started!
Definition: Accessibility (often called a11y) is the practice of making your website usable by everyone, including people with disabilities.
Why important: About 15% of the worldโs population has some form of disability. If your website is not accessible, you are excluding millions of people.
Simple explanation: Accessibility is like building ramps next to stairs. Ramps let everyone enter the building โ including people in wheelchairs, people with strollers, and people with heavy luggage.
Real-life example: A library has a ramp at the entrance so that everyone can enter. A website with good accessibility is like that library โ everyone can use it.
School example: Your school has signs in Braille for students who cannot see. That is accessibility.
Home example: Your TV has subtitles for people who are hard of hearing โ that is accessibility.
Nigerian example: In Nigeria, many buildings are being built with ramps for wheelchair users โ that is accessibility.
Illustration:
Without accessibility:
+------------------+
| Website |
| (not accessible)|
+------------------+
Some people cannot use it.
With accessibility:
+------------------+
| Website |
| (accessible) |
+------------------+
Everyone can use it! ๐
Definition: ARIA (Accessible Rich Internet Applications) landmarks are special attributes that help screen readers understand the structure of your page.
Why important: They allow screen reader users to jump directly to the main content, navigation, or other important sections of your page.
Simple explanation: ARIA landmarks are like signposts in a building. They tell a blind person, โThis is the entrance,โ โThis is the main hall,โ and โThis is the exit.โ
Real-life example: In a shopping mall, there are signs that say โFood Court,โ โRestrooms,โ and โExitโ โ those are landmarks.
School example: Your school has signs that say โLibrary,โ โCafeteria,โ and โClassroomsโ โ those are landmarks.
Home example: Your house has rooms labelled โKitchen,โ โBedroom,โ and โBathroomโ โ those are landmarks.
Nigerian example: A Nigerian market has sections labelled โFoodstuffs,โ โClothing,โ and โElectronicsโ โ those are landmarks.
Code example:
<header role="banner">...</header>
<nav role="navigation">...</nav>
<main role="main">...</main>
<aside role="complementary">...</aside>
<footer role="contentinfo">...</footer>
Definition: Sometimes, semantic HTML tags already provide the same information as ARIA landmarks. Using both is redundant and can confuse screen readers.
Why important: Modern HTML tags like <header>
and <nav> already have built-in roles. You only need
ARIA when you are using non-semantic elements.
Simple explanation: It is like putting two labels on the same door โ it confuses people. Use one label that is clear.
Code example (redundant):
<header role="banner">...</header> <!-- redundant -->
<nav role="navigation">...</nav> <!-- redundant -->
<main role="main">...</main> <!-- redundant -->
Code example (correct):
<header>...</header> <!-- semantic HTML is enough -->
<nav>...</nav> <!-- semantic HTML is enough -->
<main>...</main> <!-- semantic HTML is enough -->
<header> already
have built-in accessibility.
Definition: SEO is the practice of making your website easy for search engines like Google to find and understand.
Why important: Without SEO, your website might be invisible โ no one will find it when they search.
Simple explanation: SEO is like putting a bright sign on your shop so people can find it easily.
Real-life example: A restaurant puts a big sign on the road โ that is like SEO. People see the sign and come in.
School example: Your school has a big name on the gate โ that is like SEO. People can find the school easily.
Home example: Your house has a house number โ that is like SEO. People can find your house easily.
Nigerian example: A Nigerian business has a sign outside its shop โ that is like SEO.
Key SEO factors:
<title> โ the page title.<meta name="description"> โ a short description of the page.h1 to h6).<title> Tag โ SEOโs Best Friend
Definition: <title> is the text
that appears in the browser tab and is used by search engines to
understand your page.
Why important: It is one of the most important SEO factors. A good title helps your page rank higher.
Simple explanation: The <title>
is like the name of a book. It tells you what the
book is about.
Code example:
<title>Unity Academy โ Best School in Lagos | News & Events</title>
<title> is
the name of your page. It is very important for SEO.
Definition: A meta description is a short paragraph that summarises your page. It appears below the title in search results.
Why important: It tells people what your page is about and encourages them to click on it.
Simple explanation: A meta description is like the blurb on the back of a book โ it tells you what the story is about.
Code example:
<meta name="description" content="Unity Academy is the best school in Lagos. We offer quality education, sports, and extracurricular activities for students aged 5โ18." />
h1 to h6
Definition: Heading hierarchy is the correct order
of headings on a page โ h1 (most important) to
h6 (least important).
Why important: It helps search engines understand your content structure and helps screen reader users navigate your page.
Simple explanation: Headings are like the
chapters of a book. h1 is the title
of the book, h2 is the chapter title, and h3
is the subheading.
Code example (correct):
<h1>Unity Academy</h1>
<h2>About Us</h2>
<h3>Our Mission</h3>
<h2>Our Programs</h2>
<h3>Academic Programs</h3>
<h3>Sports Programs</h3>
Code example (incorrect):
<h2>Unity Academy</h2> <!-- should be h1 -->
<h3>About Us</h3>
<h1>Our Mission</h1> <!-- skipped h2 -->
h1 is the main title, followed by h2,
h3, and so on.
lang Attribute โ Language Matters
Definition: The lang attribute tells
the browser and screen readers what language your page is in.
Why important: It helps screen readers pronounce words correctly and helps search engines understand your page.
Simple explanation: The lang attribute
is like telling someone, โI am speaking Englishโ โ so they know
what to expect.
Code example:
<html lang="en"> <!-- English -->
<html lang="ha"> <!-- Hausa -->
<html lang="yo"> <!-- Yoruba -->
<html lang="ig"> <!-- Igbo -->
lang attribute
tells browsers and screen readers the language of your page.
Definition: The W3C Validator is a tool that checks your HTML code for errors and ensures it follows the official standards.
Why important: Valid code works better, loads faster, and is more accessible. It also helps you catch mistakes early.
Simple explanation: The W3C Validator is like a spell-checker for your HTML. It finds typos and mistakes in your code.
How to use it:
validator.w3.org.Definition: Lighthouse is a tool in Chrome DevTools that scores your website on performance, accessibility, SEO, and best practices.
Why important: It gives you a clear report on how good your website is and tells you exactly what to fix.
Simple explanation: Lighthouse is like a report card for your website. It gives you grades in different areas and tells you how to improve.
How to use it:
Definition: Best practices are the rules that good developers follow to write clean, maintainable, and reliable code.
Why important: Clean code is easier to read, easier to debug, and easier to share with others.
Simple explanation: Best practices are like good habits โ they make you a better developer and make your code easier to work with.
Key best practices:
<p> needs </p>.<div> not <DIV>.<!-- this is a comment --> to explain your code.Definition: Testing means checking your website to make sure it works correctly on different devices, browsers, and for different users.
Why important: It ensures that everyone can use your website, regardless of their device or ability.
Simple explanation: Testing is like checking your homework before you submit it โ you want to catch any mistakes.
How to test:
h1 to h6.alt text to all images.lang to the <html> tag.aria-label where needed.<title>.<meta name="description">.alt text to images.lang attribute supports all of them.alt text on images โ this is a big accessibility mistake.h1 multiple times on a page โ you should only have one h1.lang attribute โ this confuses screen readers.alt text to images.h1, then h2, etc.
+------------------------------------------+
| <header> (banner) |
| Logo, title, etc. |
+------------------------------------------+
| <nav> (navigation) |
| Home | About | Contact |
+------------------------------------------+
| <main> (main) |
| Main content of the page |
+------------------------------------------+
| <aside> (complementary) |
| Sidebar with related links |
+------------------------------------------+
| <footer> (contentinfo) |
| Copyright, contact info |
+------------------------------------------+
SEO Factors
|
V
+------------------+
| On-page SEO |
| - Title tag |
| - Meta desc. |
| - Headings |
| - Semantic HTML |
| - alt text |
+------------------+
|
V
+------------------+
| Off-page SEO |
| - Backlinks |
| - Social media |
+------------------+
|
V
+------------------+
| Technical SEO |
| - Page speed |
| - Mobile friendly|
| - Valid code |
+------------------+
h1 โ Main title (only one)
|
V
h2 โ Section title
|
+--- h3 โ Subsection title
| |
| +--- h4 โ Sub-subsection title
|
+--- h3 โ Subsection title
|
+--- h4 โ Sub-subsection title
| Feature | Purpose | When to use |
|---|---|---|
alt attribute |
Describes images for screen readers | All images |
lang attribute |
Sets the page language | Every page |
| Semantic HTML | Provides meaning to content | All content |
| ARIA landmarks | Helps screen readers navigate | When semantic HTML is not enough |
scope |
Associates headers with data cells | All tables |
| Factor | Impact | How to improve |
|---|---|---|
<title> |
High | Make it descriptive and include keywords |
| Meta description | Medium | Write a compelling summary |
| Heading hierarchy | High | Use h1 to h6 correctly |
| Semantic HTML | Medium | Use tags like <header>, <nav> |
| Page speed | High | Optimise images, use lazy loading |
Incredible work, champion! ๐ You have completed Module 7 โ and the entire HTML Level Two course!
Let us recap what you have learned in this module:
h1 to h6 correctly.lang attribute โ setting the language of your page.You now know how to build websites that are accessible, discoverable, and polished. You have completed your HTML Level Two journey โ congratulations! ๐
h1 (most important) to h6 (least important).lang attribute do?Match the concept on the left with its correct description on the right.
| Concept | Description |
|---|---|
| Accessibility | A. Helps search engines find your website |
| SEO | B. A tool that checks your HTML for errors |
| ARIA landmarks | C. Making your website usable by everyone |
| Heading hierarchy | D. Signposts for screen readers |
| W3C Validator | E. The correct order of headings from h1 to h6 |
| Lighthouse | F. A tool that scores your website |
| Best practices | G. Rules for writing clean, reliable code |
(Answers: 1-C, 2-A, 3-D, 4-E, 5-B, 6-F, 7-G)
Scenario 1: You have built a website for a Nigerian school. The website has images of the school, but you forgot to add alt text. A blind teacher tries to use the website with a screen reader.
Question: Why is this a problem? How would you fix it?
Scenario 2: Your website is not appearing on Google when people search for it. Your friend tells you to add a <title> and a meta description.
Question: Write the HTML code for the <title> and meta description for a school website called "Unity Academy".
Activity: In groups of 3โ4 students, review each other's websites (from the Mini Project in Module 6). Use the following checklist:
alt text on all images?lang attribute on the <html> tag?<title> and a meta description?Present your findings to the class and suggest improvements.
Activity: Take your favourite website (from any of the previous modules) and test it:
Write a short report on your findings and the improvements you made.
Instructions: Take any website you have built during this course (from Module 1 to Module 6) and perform an accessibility and SEO audit.
Your audit must include:
Bonus: Write a short reflection on what you learned from this process.
Assignment: Create a new HTML page for a "Unity Academy" website. The page should include:
<header> with the school name and a navigation menu.<main> section with the school's mission and vision.<footer> with contact information.alt text.h1, h2, h3).<title> and a meta description.lang attribute on the <html> tag.Run the page through the W3C Validator and Lighthouse. Fix any issues and submit the final HTML file along with a screenshot of your Lighthouse report.
<div> tags?Congratulations! You have completed HTML Level Two โ all 7 modules! You have learned so much:
You are now ready to take the next step in your web development journey. Here are some suggestions:
Keep learning, keep building, and remember โ you have the power to create amazing things on the web! ๐๐ป๐
Module 7: Accessibility, SEO & Best Practices • Written with ๐ for young coders in Nigeria and around the world.