Stop 03 · HTML FundamentalsTopics · 1/10

HTML Document Structure

Part of the Web Development Roadmap

In short

Every web page you've ever opened, from Google to your college site, starts with the same small skeleton. Learn it once and you can start any page from a blank file.

Every HTML page starts with a doctype, an html element, a head with information about the page and a body with the visible content. Elements are written as tags that can nest inside each other.

The jaadu sits at a desk sliding a handwritten letter into a stamped envelope, with a postbox waiting nearby.

Think of it like this

A letter in an envelope

A posted letter has an envelope with details for the postman, like the address and stamp, and inside, the letter you actually read. An HTML page is the same. The head is the envelope: title, character set, information for browsers and search engines. The body is the letter: everything the visitor sees.

Watch it happen

The page as a family tree

html
head
meta charset
title
body
h1
p

1/4html is the root. Every other element lives inside it.

The big ideas

What you need to know

The doctype comes first

<!DOCTYPE html> tells the browser to use modern standards mode. It's always the very first line.

Elements are tags

Most elements have an opening and closing tag, like <p>...</p>. A few, like <img> and <meta>, have no closing tag.

Nesting must be tidy

Close tags in reverse order of opening: <p><strong>hi</strong></p>, never <p><strong>hi</p></strong>.

Two meta tags always

meta charset="UTF-8" handles all characters, including the rupee sign. The viewport meta makes the page fit phone screens.

See it in code

Walk through the code

html
1<!DOCTYPE html>2<html lang="en">3  <head>4    <meta charset="UTF-8" />5    <meta name="viewport" content="width=device-width, initial-scale=1.0" />6    <title>Priya's Bakery</title>7    <link rel="stylesheet" href="style.css" />8  </head>9  <body>10    <h1>Priya's Bakery</h1>11    <p>Fresh bread in Indore, every morning from 7 a.m.</p>12    <script src="app.js" defer></script>13  </body>14</html>

1/4Doctype, then the html root. lang="en" helps screen readers and search engines.

A complete starter page. In VS Code, typing ! and pressing Tab gives you most of this skeleton.

Save yourself the pain

Common mistakes

Oops

Putting visible content like headings inside the head.

Do this instead

The head is for information about the page. Everything people should see goes in the body.

Oops

Leaving out the viewport meta tag.

Do this instead

Without it, phones show a zoomed-out desktop layout. Always include it.

Your mission

Skeleton from memory

~15 min

Quick check

Which of these belongs inside the head, not the body?

Go deeper

  1. 1Type a full HTML skeleton from memory, including the charset and viewport meta tags.
  2. 2Learn the difference between an element, a tag and an attribute.
  3. 3Open the Elements tab on any site and trace the head and body sections.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge