Lesson 4: Lists & Tables
HYPERLINK CODE ACADEMY • HTML COURSE
Lesson 04: Lists & Tables
Learn how to organize information using lists and tables.
01 — What Are HTML Lists?
Imagine you're making a list of your favorite games, songs, or hobbies. Instead of writing everything in one long paragraph, HTML lets you organize information into lists.
HTML has three main types of lists:
- Unordered lists: Lists with bullet points.
- Ordered lists: Lists with numbers.
- Description lists: Lists containing terms and their descriptions.
Let's learn how each one works!
02 — Unordered Lists
An unordered list uses bullet points. You create one with the <ul> tag.
Each item inside the list uses the <li> tag.
<ul>
<li>Minecraft</li>
<li>Terraria</li>
<li>Stardew Valley</li>
</ul>
What it looks like:
- Minecraft
- Terraria
- Stardew Valley
<ul> tag creates the list, while <li> creates each individual item.
03 — Ordered Lists
What if you want your list to have numbers instead of bullet points?
That's where ordered lists come in! They use the <ol> tag.
<ol>
<li>Open your computer</li>
<li>Open your browser</li>
<li>Visit your website</li>
</ol>
What it looks like:
- Open your computer
- Open your browser
- Visit your website
The browser automatically numbers each item for you.
04 — Description Lists
Description lists are useful when you want to display a word or term alongside its explanation.
They use three tags:
<dl>— Creates the description list.<dt>— Defines the term.<dd>— Provides the description.
<dl>
<dt>HTML</dt>
<dd>The language used to structure web pages.</dd>
<dt>CSS</dt>
<dd>The language used to style web pages.</dd>
</dl>
What it looks like:
- HTML
- The language used to structure web pages.
- CSS
- The language used to style web pages.
05 — What Are HTML Tables?
Tables organize information into rows and columns. They're useful for displaying schedules, scores, prices, and other information.
HTML tables use several important tags:
<table>— Creates the table.<tr>— Creates a table row.<th>— Creates a heading cell.<td>— Creates a regular data cell.
<table>
<tr>
<th>Game</th>
<th>Genre</th>
</tr>
<tr>
<td>Minecraft</td>
<td>Sandbox</td>
</tr>
<tr>
<td>Terraria</td>
<td>Adventure</td>
</tr>
</table>
What it looks like:
| Game | Genre |
|---|---|
| Minecraft | Sandbox |
| Terraria | Adventure |
06 — Understanding Table Rows and Cells
Let's break down the table structure a little more.
<tr>
<th>Name</th>
<th>Age</th>
</tr>
This creates one row containing two heading cells.
<tr>
<td>Alex</td>
<td>12</td>
</tr>
This creates another row containing two regular cells.
07 — Try It Yourself!
Now it's your turn to experiment. Create a small HTML page that includes:
- A heading called "My Favorite Things".
- An unordered list with three favorite things.
- An ordered list showing three steps for something you enjoy.
- A table with two columns: Name and Category.
- At least two rows of information in your table.
Here's a starting point:
<!DOCTYPE html>
<html>
<head>
<title>My Favorite Things</title>
</head>
<body>
<h1>My Favorite Things</h1>
<!-- Add your lists and table here -->
</body>
</html>
Try writing the code yourself before looking back at the examples!
08 — Quick Knowledge Check
Question 1: Which tag creates an unordered list?
Question 2: Which tag creates a table row?
Question 3: Which tag creates a regular table cell?