What Is HTML?
HTML (HyperText Markup Language) is not a programming language — it has no logic, no calculations, no conditionals. It's a markup language: plain text wrapped in tags that describe what each piece of content is (a heading, a paragraph, a link) rather than how it should look. That separation — structure in HTML, appearance in CSS, behaviour in JavaScript — is the foundation everything else in web development builds on.
The Minimal Valid HTML Document
Every single web page, no matter how complex, is built around this same skeleton. Breaking it down piece by piece:
<body>. If it's information aboutthe page itself — title, character set, links to CSS files — it goes in <head>.
Tags — Opening, Closing, and Self-Closing
Most HTML elements come in pairs: an opening tag and a matching closing tag, with content between them.
Some elements never contain content and don't need a closing tag at all — these are void elements, and Chapter 5 (images) and Chapter 7 (forms) both use several of them.
Attributes — Adding Information to a Tag
Attributes live inside the opening tag, as name="value" pairs, and add extra information or behaviour to an element. The src and alt in the <img> example above are both attributes.
<img src=photo.jpg> often works in practice, but it's technically invalid and breaks the moment the value contains a space or special character. <img src="photo.jpg"> always works correctly — quoting consistently from the start avoids a class of bug that only shows up later.
Nesting and Indentation
Elements can contain other elements — and consistent indentation, while not required by the browser at all, makes a document's structure genuinely readable to a human looking at the source.
Chapter 1 Quick Reference
- <!DOCTYPE html> — always the first line, triggers modern rendering
- <html> — the root element containing everything else
- <head> — metadata, not visible on the page; <body> — everything visible
- <title> — required inside <head>, shown in the browser tab
- Opening/closing tag pairs wrap content; void elements (img, br, hr) never do
- Attributes — name="value" pairs inside the opening tag; always quote the value
- id — unique per page; class — shareable across many elements
- Next chapter: text basics — headings, paragraphs, and text formatting tags