Lesson 1 of 7
Your First Page
Make a web page from nothing. One key press writes the skeleton. You write the words.
What you will learn
- ! then Tab
- <!DOCTYPE html>
- <head> and <body>
- <title>
- <h1> and <h2>
- <p>
- Opening and closing tags
Before you start
Nothing at all. This is the first lesson of the first course. You do not need to have seen code before.
What this page does
- It shows a heading, a smaller heading, and three paragraphs.
- That is all. There is no colour, no layout, and no picture.
- Everything you see is the browser's own styling. Nobody chose those sizes. The browser draws the heading big because you wrote
<h1>. The tag<h1>means heading.
One key press writes the skeleton
Every HTML page starts with the same nine lines. Nobody types them. In Visual Studio Code you type one character and press Tab.
A new file called index.html. Nothing in it yet.
.html file. Type ! and press Tab. Visual Studio Code writes everything from <!DOCTYPE html> to </html> for you.That shortcut is called Emmet. It is built into Visual Studio Code. You do not install anything.
- Make a new file and save it as
index.html. The.htmlending is what matters. - Type a single
!on the first line. - Press Tab.
The two halves of a page
Everything inside <html> sits in one of two boxes. The difference between those two boxes is the first real idea in this course.
| Part | What it is for | Does it show on screen? |
|---|---|---|
<!DOCTYPE html> | Tells the browser this is modern HTML | No |
<html lang="en"> | The root. Everything else lives inside it | No |
<head> | Facts about the page. Its settings | No |
<title> | The name of the page | On the browser tab |
<body> | Everything a visitor actually sees | Yes |
Change the <title> in your copy. Watch the tab of your browser, not the page. Students look for the title on the page every time. It is not there. That is the point of <head>.
Build it step by step
Do this in your own editor as well as in the copy beside this guide. The point of lesson 1 is that you can make a page on your own computer.
Make the file
Make a folder for this lesson. Inside it, make a file called
index.html. Open it in Visual Studio Code.Get the skeleton
Type
!and press Tab. Nine lines appear. Read them once, from top to bottom. Find<head>and<body>.Name the page
Change the text inside
<title>to your own title. Save the file. Open it in a browser by double-clicking it. The tab shows your title. The page is still blank. That is because<body>is still empty.Write a heading
Inside
<body>, add an<h1>with your name in it. Save the file. Reload the page.<body> <h1>My First Page</h1> </body>Write a paragraph
Under the heading, add a
<p>with one sentence about yourself. Save and reload. Add a second<p>and reload again.Add a section
Add an
<h2>and a<p>under it. The<h2>is smaller than the<h1>. You did nothing to make that happen.
Try these changes
Make these changes in the files beside this guide. Each one only uses what this lesson has already covered. Tick each one when it works.
Check yourself
Three quick questions on this lesson. Get them all right to finish the lesson and earn a pack.
Loading your answers
Teacher's versionHow to run this lesson, what to check, and any answers. Students do not need this.
How to teach it
- Do the
!and Tab trick live on a projector, before anyone touches a keyboard. It takes four seconds. That is the moment the room decides this is doable. - Make everyone save the file as
index.htmlbefore typing anything. Emmet does nothing in a file the editor thinks is plain text. That is the most common reason a student's Tab key seems broken. - Have them change the
<title>. Then ask where it appeared. Let them hunt for it on the page for a moment. Then point at the tab. That confusion is the lesson. - Break a tag on purpose in front of them and reload. Say out loud that HTML never shows an error message. Saying it now saves a lot of panic later.
- Do not mention CSS, colours, or fonts. Someone will ask. Tell them CSS is lesson 3. Today is about what the page is.