2059↗learn.

Your first page

Turn a plain text file into a web page.

A page starts with structure

HTML describes the content of a page. An element usually has an opening tag, some content, and a closing tag. In <h1>Hello</h1>, h1 tells the browser that Hello is a top-level heading.

Give the browser a complete document

The doctype selects modern HTML rendering. The html element wraps the document; lang describes its language. The head contains metadata, including the tab title and viewport settings. The body contains the content people see.

Make a small change

Edit the heading in the example, then run it. The preview is a real, isolated web page. You can experiment here without changing this lesson.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My first page</title>
</head>
<body>
  <h1>Something starts here.</h1>
  <p>This is my first web page.</p>
</body>
</html>

Enable JavaScript to edit and run the example in the playground.

Your turn

Change the heading to your name. Add a second paragraph about something you want to build.

Check your understanding

Where does the visible page content belong?

  • Inside <head>
  • Inside <body>
  • Inside <title>
Show answer and explanation

Inside <body>. The body contains the visible document content. The head holds metadata.

MDN reference ↗

Next lesson →

Search by topic, concept, or language. Escape to close.

Reset local data?