HTML Document Structure
Every HTML page follows a standard structure. In this chapter, you will learn the meaning of doctype, html, head, title, meta tags, body section and comments.
DOCTYPE
Tells the browser that the document uses modern HTML.
Head Section
Stores title, meta information and links to CSS files.
Body Section
Contains visible content shown on the webpage.
Viewport
Makes the webpage responsive on mobile and tablets.
After This Chapter, You Will Understand
This chapter teaches the basic skeleton used in every professional HTML page.
HTML Skeleton
Understand the basic structure used in every HTML document.
Head Section
Understand page title, meta tags and browser information.
Body Section
Understand where visible webpage content is written.
Viewport
Understand how viewport supports mobile-friendly pages.
Standard HTML Document Structure
This is the standard structure you should write in almost every HTML page.
<html lang="en"> # Root element of the page
<head> # Page information for browser and search engines
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Page</title>
</head>
<body> # Visible webpage content
<h1>Welcome to HTML</h1>
<p>This is my first webpage.</p>
</body>
</html>
Meaning of Each Important Part
Understand the use of every basic tag in the HTML structure.
| Code / Tag | Meaning | Visible on Page? |
|---|---|---|
| <!DOCTYPE html> | Declares that the document is using modern HTML. | No |
| <html> | Root element that contains the complete webpage. | No |
| <head> | Contains information about the page such as title and meta tags. | No |
| <title> | Shows the page title in the browser tab. | Browser Tab |
| <body> | Contains all visible webpage content. | Yes |
| <h1> | Main heading of the page. | Yes |
| <p> | Paragraph text. | Yes |
Important Meta Tags in HTML
Meta tags help browsers, mobile devices and search engines understand the page.
Charset Meta Tag
This tells the browser which character encoding to use.
Viewport Meta Tag
This helps the page display properly on mobile and tablet screens.
Description Meta Tag
This gives a short summary of the page for SEO and search results.
Edit a Complete HTML Structure
Change the title, heading and paragraph. Then click Run Code.
Mistakes Students Should Avoid
These small mistakes can break page structure or create confusion.
Wrong Habits
- Writing visible content inside the head section
- Forgetting the body tag
- Not writing the title tag
- Missing viewport meta tag
- Writing messy code without indentation
Correct Habits
- Write title and meta tags inside head
- Write visible content inside body
- Use proper indentation
- Keep one clean structure for every page
- Use comments to explain important code blocks
Test Your Understanding
Select the correct answers and check your score.
1. Which declaration is used at the start of modern HTML document?
2. Which section contains visible webpage content?
3. Which tag shows the page name in browser tab?
4. Which meta tag helps mobile-friendly display?
5. Page information like meta tags is written inside:
Remember These Points
Revise these before moving to Chapter 4.
DOCTYPE
It declares that the document is using modern HTML.
HTML Tag
It is the root element that contains the complete webpage.
Head Section
It contains title, meta tags, CSS links and page information.
Body Section
It contains the visible content displayed in the browser.
Title Tag
It shows the page title in the browser tab.
Viewport
It helps the webpage display properly on mobile screens.