Why do we need this structure?
Just like a letter has "From", "To", "Date", "Subject" and then "Body" — HTML also has a fixed structure that every browser understands.
The skeleton explained:
1<!DOCTYPE html>
2
3<html lang="en">
4
5<head>
6
7 <meta charset="UTF-8">
8
9 <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
11 <title>Page Title</title>
12
13</head>
14
15<body>
16
17 <!-- All visible content goes here -->
18
19</body>
20
21</html>Line by line explanation:
Line | What it means | Why it's important |
|---|---|---|
<!DOCTYPE html> | "Browser, use HTML5 rules" | Without this, browser uses old buggy mode |
<html lang="en"> | "My page is in English" | Helps Google and screen readers |
What happens if you forget something?
Missing element | What happens | gf |
|---|---|---|
