HTML5
HTML5

HTML Document Structure

An HTML document has a clear shape. Think of it like a box inside a box. <!DOCTYPE html> comes first. Then <html> wraps the whole document. Inside it are two big parts: <head> and <body>. The <head> is the page's backstage area. It can contain the character set, page title, CSS links, and other information. The <body> is the stage. This is where headings, paragraphs, images, links, forms, and other visible content live. HTML elements can also be nested. If one element lives inside another, close the inside element first. This keeps the document easy for browsers and humans to understand.

Why this matters

  • ·A clear structure makes pages easier to build.
  • ·Nested elements show which content belongs together.
  • ·The structure gives browsers and assistive technology useful information.

Common mistakes

  • ·Putting visible content in the wrong place can make the document confusing.
  • ·Closing nested elements in the wrong order can create bugs.
  • ·Skipping the document structure makes larger pages harder to maintain.
Your codeHTML
Live preview

Frequently asked questions

Information about the page, such as its title, character encoding, and linked resources.

Practice questions

Question 1

Make a page with a title in <head> and a heading in <body>.

Your codeHTML
Live preview

Question 2

Put a paragraph inside the body.

Your codeHTML
Live preview

Quick check

Just for this topic answer honestly, then check yourself.

1 / 3

Where does the page title go?