Lesson 23 of 55
HTMLBasic Document Structure
6 min
Course progress42%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 23 of 55
HTML6 min
Keep these ideas in mind as you work through the lesson.
Every HTML document follows the same hierarchy:
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='UTF-8' />
<meta name='viewport' content='width=device-width, initial-scale=1' />
<title>Page Title</title>
<!-- CSS, favicons, meta tags go here -->
</head>
<body>
<!-- Visible content goes here -->
</body>
</html>
<!DOCTYPE html> – Triggers standards‑mode rendering across browsers.<html> – Root element; the lang attribute declares the page language for assistive technologies and SEO.<head> – Holds metadata, external resources, and the title.<meta charset='UTF-8'> – Must be the first meta tag; it sets the character encoding to UTF‑8.<meta name='viewport'> – Essential for responsive design on mobile devices; defines the logical viewport width.<title> – Shows up in the browser tab, bookmark bar, and search‑engine results.<body> – Contains everything displayed to the user.<head> lightweight. Load critical CSS early, defer non‑essential scripts.<header>, <main>, <footer>) over generic <div> containers.lang) as early as possible for SEO and screen readers.Tip: The
<title>should be under 60 characters to prevent truncation in search results.
<html lang='…'> defined? ✅<meta charset='UTF-8'> first in <head>? ✅<meta name='viewport'> included? ✅<header>, <main>, <footer>) used? ✅If any of the above are missing, add them now before moving on.