Minimum HTML document

A small HTML document needs a doctype, a root element, metadata, and visible body content.

What you will learn

Minimal example

<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>My page</title> </head> <body> <h1>Hello</h1> </body> </html>

Save the code as index.html and open it in a browser. The heading appears because it is inside body.

Common mistakes