HTML Exercises
Fill in the blanks to check your knowledge. Each exercise belongs to a lesson.
HTML Introduction
Exercise
Complete the heading so it shows "Welcome".
<>Welcome</>
HTML Editors
Exercise
Which file extension does an HTML page use?
index.Page Structure
Exercise
Which element holds everything visible on the page?
<html> <head><title>Page</title></head> <>Hi</> </html>
HTML Elements
Exercise
Close the paragraph element.
<p>Hello</>
HTML Attributes
Exercise
Add a tooltip to the link.
<a href="/about" ="About us">About</a>
Headings and Paragraphs
Exercise
Make the word "never" important.
<p>Do <>never</> share your password.</p>
Text Formatting
Exercise
Highlight the word.
<p>This is <>key</>.</p>
Quotations and Citations
Exercise
Use the element for a short inline quote.
<p>He said <>hello</>.</p>
HTML Comments
Exercise
Close the comment.
<!-- A note >
HTML Colors
Exercise
Set the text colour.
<p style=": blue">Hi</p>
HTML and CSS
Exercise
Add an internal style sheet.
<> p { color: red; } </>
Links
Exercise
Complete the link attribute.
<a ="https://example.com">Go</a>
Link Targets and Types
Exercise
Make the link open in a new tab.
<a href="/" ="_blank">Home</a>
Page Bookmarks
Exercise
Link to the element with id "contact".
<a href="contact">Contact</a>
HTML Headings
Exercise
Make the main title.
<>My Page</h1>
HTML Paragraphs
Exercise
Start a paragraph.
<>Hello</p>
Line Breaks, hr and pre
Exercise
Break a line.
Line one<>Line two
Abbreviations, Address and Citations
Exercise
Explain an abbreviation.
<abbr ="Hypertext Markup Language">HTML</abbr>
Strong, Em, Mark and Code
Exercise
Highlight text.
<>note</mark>
Link Colours and States
Exercise
State when the mouse is over.
a: { color: red }
Links That Look Like Buttons
Exercise
Make the link block like.
display: -block;
Email and Phone Links
Exercise
Open an email.
<a href=":me@example.com">Mail</a>
Download and Target Links
Exercise
Open in a new tab.
target=""
Images
Exercise
Add the attribute that describes the image for screen readers.
<img src="cat.jpg" ="A sleeping cat">
Responsive Images
Exercise
Stop the image overflowing its container.
img { max-width: ; height: auto; }
Favicon and Page Icons
Exercise
Complete the rel value for a favicon.
<link rel="" href="/favicon.png">
Audio and Video
Exercise
Show the play and pause buttons.
<audio src="a.mp3" ></audio>
Image Width and Height
Exercise
Set the width.
<img ="200" src="a.png" alt="">
Image as a Link and Floating Images
Exercise
Float an image left.
float: ;
Image Maps
Exercise
Attach a map.
<img ="#m">
Figure and Caption
Exercise
Caption element.
<>Caption</figcaption>
HTML Audio
Exercise
Show play buttons.
<audio >
HTML Video
Exercise
Preview image attribute.
<video ="cover.jpg">
Embedding YouTube and Maps
Exercise
Lazy load an embed.
<iframe loading=""></iframe>
Object and Embed
Exercise
Provide the file.
<object ="file.pdf"></object>
The Page Title
Exercise
Set the page title.
<>My Page</>
The head Element and Meta Tags
Exercise
Complete the meta tag for the character set.
<meta ="UTF-8">
The Viewport Meta Tag
Exercise
Use the real device width.
<meta name="viewport" content="width=-width, initial-scale=1">
Character Sets
Exercise
Which character set should you use?
<meta charset="-8">
File Paths
Exercise
Go up one folder.
<a href="/index.html">Back</a>
Doctype and Document Structure
Exercise
Declare HTML5.
<!DOCTYPE >
The base and noscript Elements
Exercise
Show content without JavaScript.
<>Enable JS</noscript>
Language and Text Direction
Exercise
Right to left.
<p dir="">text</p>
Tooltips with the title Attribute
Exercise
Add a tooltip.
<span ="Help">?</span>
More HTML Entities
Exercise
Show a less than sign.
5 10
Comments and Code Hygiene
Exercise
Start a comment.
note -->Common HTML Mistakes
Exercise
Describe an image.
<img src="a.jpg" ="Cat">
HTML Tag Overview
Exercise
Void tag for a line break.
Line one<>Line two
Lists
Exercise
Complete the numbered list.
<> <>First</> </>
Nested and Styled Lists
Exercise
Remove the list markers.
ul { list-style-type: ; }
Description Lists
Exercise
Which tag holds a term?
<dl> <>HTML</> <dd>Structure</dd> </dl>
Tables
Exercise
Which tag makes a table row?
<table> <> <td>Hello</td> </> </table>
Table Headers, Captions and Spans
Exercise
Make the cell span two columns.
<td ="2">Wide</td>
Styling Tables
Exercise
Merge the cell borders.
table { border-: collapse; }
List Styles and Types
Exercise
Start numbering at 5.
<ol ="5">
Lists as Navigation
Exercise
Remove list markers.
list-style: ;
Table Borders and Padding
Exercise
Merge borders.
border-collapse: ;
Table Caption, Head, Body and Foot
Exercise
Title the table.
<table><>Scores</caption>
Zebra Striped and Hover Tables
Exercise
Select even rows.
tr:nth-child()
Responsive Tables
Exercise
Scroll sideways.
overflow-x: ;
Table Alignment and Cell Sizing
Exercise
Merge two columns.
<th ="2">
Block and Inline Elements
Exercise
Which value makes an element inline?
div { display: ; }
The div and span Elements
Exercise
Wrap part of a sentence in an inline container.
<p>Hello <>world</></p>
The class Attribute
Exercise
Give the element the class "card".
<div ="card">Hi</div>
The id Attribute
Exercise
Which selector targets id "hero"?
hero { color: red; }Semantic Layout
Exercise
Which element holds the main content of the page?
<> <p>Content</p> </>
Page Layout
Exercise
Put children side by side.
.wrap { display: ; }
Responsive Web Design
Exercise
Allow flex items to move to the next line.
.cols { display: flex; flex-wrap: ; }
Iframes
Exercise
Add the accessible name of the iframe.
<iframe src="/map" ="Our location"></iframe>
HTML and JavaScript
Exercise
Add the element that holds JavaScript.
<>console.log("hi");</>
Header and Footer
Exercise
Closing content element.
<>© 2026</footer>
Section, Article and Aside
Exercise
Standalone post.
<><h3>Post</h3></article>
Float Layouts
Exercise
Clear floats.
clear: ;
Flexbox Layout
Exercise
Make a flex container.
display: ;
CSS Grid Layout
Exercise
Define columns.
grid-template-: 1fr 1fr;
Responsive Pages and Media Queries
Exercise
Wide screens rule.
@media (min-: 600px)
Computer Code Elements
Exercise
Keep the spaces and line breaks.
<>line 1 line 2</>
HTML Entities
Exercise
Show a less-than sign as text.
<p>5 &; 10</p>
Symbols and Emojis
Exercise
Label the emoji for screen readers.
<span role="img" ="star">⭐</span>
URL Encoding
Exercise
Which code stands for a space in a URL?
my%file.pdf
Forms
Exercise
Make the input accept an email address.
<input type="">
Form Attributes
Exercise
Send private data in the request body.
<form method="">
Input Types
Exercise
Hide what the user types.
<input type="">
Input Attributes
Exercise
Make the field mandatory.
<input name="email" >
Select, Textarea and Buttons
Exercise
Add a dropdown choice.
<select> <>Lagos</> </select>
Fieldset and Form Validation
Exercise
Name a group of fields.
<fieldset> <>Contact</> </fieldset>
HTML Forms
Exercise
Where to send data.
<form ="/save">
Radio Buttons and Checkboxes
Exercise
Group radios together.
<input type="radio" ="size">
Select Lists and Option Groups
Exercise
Preselect an option.
<option >Volvo</option>
Textarea and Datalist
Exercise
Set visible lines.
<textarea ="4"></textarea>
Date, Colour and Range Inputs
Exercise
Pick a colour.
<input type="">
File Upload
Exercise
Allow several files.
<input type="file" >
GET versus POST
Exercise
Send in the body.
<form method="">
Readonly, Disabled and Hidden Fields
Exercise
Block editing but send value.
<input value="x" >
Placeholder, Autofocus and Autocomplete
Exercise
Focus on load.
<input >
Form Buttons
Exercise
A button that clears fields.
<button type="">Clear</button>
Project: Personal Profile Page
Exercise
List of skills tag.
<><li>HTML</li></ul>
Project: A Blog Layout
Exercise
Main content tag.
<>...</main>
Project: A Price Table
Exercise
Header for a row.
<th ="row">
Project: Contact Form
Exercise
Required field.
<input >
Canvas
Premium exercise. See plans
SVG Graphics
Premium exercise. See plans
Accessibility Basics
Premium exercise. See plans
HTML Style Guide
Premium exercise. See plans
Semantic Landmarks
Premium exercise. See plans
Built in Form Validation
Premium exercise. See plans
datalist, fieldset, meter and progress
Premium exercise. See plans
The dialog Element
Premium exercise. See plans
details, summary and popover
Premium exercise. See plans
Responsive Images
Premium exercise. See plans
ARIA Basics
Premium exercise. See plans
Custom Elements
Premium exercise. See plans
template, slot and Shadow DOM
Premium exercise. See plans
Metadata and SEO
Premium exercise. See plans
Structured Data with JSON-LD
Premium exercise. See plans
iframe and Sandboxing
Premium exercise. See plans
Canvas Animation
Premium exercise. See plans
SVG Paths and Gradients
Premium exercise. See plans
Audio, Video and Captions
Premium exercise. See plans
Global Attributes
Premium exercise. See plans
HTML Performance
Premium exercise. See plans
Accessibility Checklist
Premium exercise. See plans
HTML Email Basics
Premium exercise. See plans
Print Friendly Pages
Premium exercise. See plans
Validating and Linting HTML
Premium exercise. See plans
A Complete Page Template
Premium exercise. See plans
Project: Accessible Signup Form
Premium exercise. See plans