HTML Essentials

Basic Structure

Understand the required shape of an HTML document.

A predictable document structure helps browsers render content correctly.

Important definitions

DOCTYPE
Declares the HTML standard.
Head
Stores page metadata.
Body
Contains visible page content.

Syntax

Use this general pattern as a reference:

HTML
<!doctype html><html><head></head><body></body></html>

Examples

Basic Structure worked example

EXAMPLE 1
<!doctype html>
<html lang="en">
<head><meta charset="utf-8"><title>Home</title></head>
<body><p>Welcome</p></body>
</html>
ResultA page containing Welcome.
Try it yourself

Expected output

A page containing Welcome.

Note

Most content belongs inside body.

Tip

Add a language, character set, and descriptive title to every page.

Common mistakes

  • Putting visible headings in head.
  • Omitting the doctype.