Lesson 2 ยท Make a web page
Tags are labels
Write real HTML to make an "All about me" page.
About 15 minutes
Tab indents. Press Escape, then Tab, to leave the editor.
In the last lesson you met tags, the words in pointy brackets. Now you'll learn how they work and write them yourself. By the end you'll have your very own "All about me" page. ๐
Tags are labels on boxes
Imagine you're packing up your room. You put things in boxes and stick a label on each one: "BOOKS ๐", "TOYS ๐งธ", "SOCKS ๐งฆ". The label doesn't change what's inside. It just tells everyone what the box holds.
Tags work the same way. They wrap around a piece of your page and tell the browser what it is:
<h1>My Awesome Page</h1>
The browser reads this and thinks: "Aha, this is the big main title!" Then it draws the words big and bold.
Opening and closing
Most tags come in pairs, like the two sides of a sandwich. ๐ฅช
- The opening tag goes at the start:
<h1> - The closing tag goes at the end. It looks the same, but with a slash:
</h1> - Your words go in the middle, like the filling.
The whole thing together, from the opening tag to the closing tag, is called an element. So <h1>My Awesome Page</h1> is one heading element.
Some tags to know
Here are a few tags you'll use all the time. The letters are short for real words, which makes them easier to remember.
| Tag | Short for | What it's for |
|---|---|---|
<h1> | heading 1 | The biggest, most important title. Usually one per page. |
<h2> | heading 2 | A smaller title for each part of your page |
<p> | paragraph | Ordinary sentences |
<strong> | strong | Words that really matter. They show up bold. |
<ul> | unordered list | A list with dots instead of numbers |
<li> | list item | One thing in a list |
There are headings all the way from <h1> down to <h6>, which gets smaller each time.
Boxes inside boxes
Some tags hold other tags inside them, like a big box with smaller boxes in it. ๐ฆ A list is a great example. The <ul> is the big box, and each <li> is a small box inside:
<ul>
<li>Pizza</li>
<li>Swimming</li>
<li>Dragons</li>
</ul>
See how the <li> lines are pushed in a little? That's called indenting. The browser doesn't need it, but it helps people see which boxes are inside which.
When you put tags inside other tags, close the inside one first. A small box has to be closed before you can close the big box around it.
Make your "All about me" page
Now it's your turn to be the web page builder! ๐ ๏ธ
Challenge
All about me
Make this page all about you:
- Put your name (or a nickname) in the big
<h1>title. - Change the paragraph to a sentence about you.
- Make the list show at least 3 things you like. Each one needs its own
<li>.
Bonus: wrap one important word in <strong> and </strong> to make it bold.
- Your big title has your name in it
- Your paragraph tells us something about you
- Your list has at least 3 things you like
What you learned
- Tags are labels that tell the browser what each part of the page is.
- Most tags come in pairs: an opening tag like
<p>and a closing tag like</p>. Together with what's inside, they make an element. <h1>and<h2>make titles,<p>makes paragraphs,<strong>makes bold words, and<ul>with<li>makes a list.- Tags can go inside other tags, like boxes inside boxes.
- You built your own "All about me" page! ๐
Finished this lesson?
Mark it complete to track your progress on this device.