Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.64 KB

README.md

File metadata and controls

55 lines (37 loc) · 1.64 KB

03. HTML document anatomy

Write a complete valid HTML document.

Learn

  • DOCTYPE
  • html lang
  • head
  • title
  • meta charset
  • viewport
  • body

Build

Create a page with a useful title, language, viewport, heading, and paragraph.

Check your work

  • Open the result in a browser and inspect the HTML and computed CSS.
  • Test at narrow and wide widths and use the keyboard for interactive elements.
  • Write down one thing you changed after testing.

Deep lesson

How it works

The doctype tells the browser to use standards mode. The html element declares the document language; head holds metadata and linked resources; body contains rendered page content. A unique title identifies each page in tabs, history, and search results. The character encoding should be declared near the start of head, and the viewport setting allows layouts to use device width.

Common mistake

Putting visible content in head or omitting a useful title makes the document harder to use. A language value should reflect the actual page language.

Guided challenge

Start with a blank file and write the complete document skeleton from memory. Change lang and title, inspect the browser tab, then use View Source to locate the head and body.

Completion check

  • Rebuild the core idea without copying the example line by line.
  • Explain the key HTML or CSS choice in your own words.
  • Test the result at a narrow width and with keyboard navigation where relevant.

Run the example

Open example.html in a browser. Edit style.css, save, and refresh.

Try: Change the title and document language, then inspect the browser tab and source.