Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 0.4 — Your First Complete HTML Page
HTML · Example 2 of 2

The browser repairs a misplaced heading

The heading was written in the head, but the browser moved it into the body. The page looks fine; the HTML you wrote isn't the HTML you got.

A proper HTML page has a fixed skeleton: a doctype, an html element with a language, a head with information about the page, and a body with what you see.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 3 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Write the complete skeleton of a page titled Recipes with an <h1> saying My recipes and one paragraph.

02

Change your page to French: what attribute value do you change?

Explain it without notes

01

What goes in the <head> and what goes in the <body>?

02

Why should every page start with <!DOCTYPE html>?

03

What does lang="en" do, and who benefits from it?

The browser repairs a misplaced heading

Preview

Press Run to see the page.

Console

Nothing logged yet.

Expected console output

Heading inside head? false
Heading inside body? true