SA-21/06, C-11, Asapur, Varanasi, UP support@kamaldnp.com +91 8318013442
HTML
1. HTML Introduction: What is HTML? Learn with Examples 2. Best Free HTML Editors: Notepad to VS Code for Beginners 3. HTML Basic Structure: Doctype, Head, Body Explained 4. HTML Elements Explained: Tags, Content & Empty Elements 5. HTML Attributes List: href, src, alt, width, title & More 6. HTML Headings h1 to h6: Which Heading Tag to Use When 7. HTML Paragraphs: p Tag, br Line Breaks & pre Text 8. HTML Style Attribute: Colour, Font Size & Alignment 9. HTML Text Formatting Tags: bold, italic, mark & More 10. HTML Comments: How to Add Notes & Hide Code in HTML 11. HTML Colors: Names, HEX, RGB & HSL Colour Codes 12. HTML CSS: Inline, Internal & External Stylesheets 13. HTML Links: a Tag, href, New Tab & Email Links 14. HTML Images: img Tag, src, alt, Width & Formats 15. HTML Favicon: Create & Add a Browser Tab Icon 16. HTML Title Tag: How to Write a Good Page Title 17. HTML Tables: table, tr, th, td, colspan & rowspan 18. HTML Lists: ul, ol, dl & Nested Lists Explained 19. HTML Block vs Inline Elements: div, p, span Explained 20. HTML Div Tag: Group Content & Build Page Layouts 21. HTML Class Attribute: Style Many Elements at Once 22. HTML id Attribute: Unique IDs, Links, CSS & JavaScript 23. HTML Iframes: Embed YouTube, Maps & Pages in HTML 24. HTML JavaScript: script Tag, Clicks & First Example 25. HTML File Paths: Relative vs Absolute Paths Explained 26. HTML Head Element: title, meta, charset & viewport 27. HTML Layout: header, nav, main, footer Page Structure 28. HTML Responsive Design: Viewport, Images & Media Queries 29. Semantic HTML Tags: header, nav, main, article & footer 30. HTML Forms: input, label, select, checkbox & Submit 31. HTML Entities: & < > © with Examples 32. HTML Audio & Video Tags: controls, source & Fallback 33. HTML Accessibility: alt Text, Labels, Landmarks & ARIA 34. HTML Meta Tags & SEO: charset, viewport, OG Tags 35. HTML Quotations: blockquote, q, cite, abbr & address
Final Test — Certificate ₹10
Try this code live
Lesson 27 of 35

HTML Layout: header, nav, main, footer Page Structure

4 min read · Free · No login needed

A well-built page is divided into clear sections. HTML gives you semantic layout elements for that — tags whose names say what the section is. Using them makes your page easier to read, better for Google, and easier for screen readers to navigate.

Diagram — see how it fits together
Infographic: the big blocks of a page layout

The classic layout

  • <header> — the top of the page: logo, site name, and usually the navigation.
  • <nav> — the navigation menu, with links to the main pages.
  • <main> — the main content of the page. Only one per page.
  • <section> — a themed group of content inside the main area.
  • <article> — a self-contained piece of content, like a blog post or a news story.
  • <aside> — side content: a sidebar, related links, an ad.
  • <footer> — the bottom of the page: contact details, copyright, extra links.

How it looks in code

The order is almost always the same: header, nav, main (with sections and articles), aside, footer. This pattern is so common that visitors expect it — they look for the menu at the top and the contact details at the bottom without thinking.

Tip: Before writing any code for a new page, sketch the layout on paper — a rectangle for the header, one for the menu, a big one for the content, a small one for the sidebar, one for the footer. Then write one tag per rectangle. The code almost writes itself.

What a layout is

A layout is how the parts of a page are arranged: a header at the top, a navigation menu, the main content in the middle, maybe a sidebar, and a footer at the bottom. In the early days of the web, people built layouts with tables. Today we use semantic tags for the parts and CSS — usually Flexbox or Grid — for the positioning.

Syntax — the classic layout

Most websites use the same skeleton. Here it is with semantic tags:

<header>Logo and site title</header>
<nav>Home | Courses | Blog | Contact</nav>
<main>
  <section>Main content goes here</section>
  <aside>Sidebar: links and ads</aside>
</main>
<footer>Copyright and contact info</footer>

Each tag has a job: <header> is the top of the page, <nav> holds the menu, <main> holds the page's main content (only one per page), <aside> is the side content, and <footer> is the bottom.

Note: HTML only names the parts. It does not place them side by side — that is CSS. A <main> with a <section> and an <aside> will stack vertically until you add CSS like display: flex; to put them next to each other.
Tip: Before writing any code, sketch the layout on paper: draw rectangles for header, menu, content, sidebar, and footer. Ten seconds of sketching saves an hour of moving divs around.

Common mistakes

  • Building a layout with a table — tables are for data, not for page structure.
  • Using two <main> elements on one page — there must be only one.
  • Putting the navigation links in a plain div instead of <nav> — screen readers then cannot find the menu.
  • Forgetting the layout on mobile — a sidebar that sits beside the content on desktop should stack below it on a phone.

Example explained

  • <header><h1>My Website</h1></header> — the top of the page: the site name.
  • <nav> — the navigation menu. The two links inside are the main pages of the site.
  • <main> — the main content of the page. There is only one per page, and everything important sits inside it.
  • <section> and <aside> — the section holds the main content, the aside holds the side content (related links) that sits beside it.
  • <footer> — the bottom of the page: copyright and contact information.

Example

Example
<!DOCTYPE html>
<html>
<head>
<title>Layout</title>
</head>
<body>

<header><h1>My Website</h1></header>
<nav><a href="#">Home</a> | <a href="#">About</a></nav>
<main>
<section><h2>Welcome</h2><p>Main content here.</p></section>
<aside><p>Sidebar: related links.</p></aside>
</main>
<footer><p>© 2026 My Website</p></footer>

</body>
</html>

Output

Output — how it looks in the browser
Output of HTML Layout: header, nav, main, footer Page Structure

Try it yourself — live editor

Change the code below and press Run to see the result instantly. No file to save, no login needed.

Result

Frequently asked questions

The questions learners ask most about this lesson — read the question, then open it to see the answer.

1. What is the classic order of a page layout?

Header, nav, main with sections and articles, aside, then footer, a pattern visitors expect.

2. How many main elements can a page have?

Only one, and everything important on the page sits inside it.

3. Does HTML place layout parts side by side?

No, HTML only names the parts; CSS such as Flexbox or Grid positions them, otherwise they stack vertically.

Why learn this yourself — and not just ask AI?

AI can write code for you, but it cannot think for you. When you learn HTML yourself, your brain builds the real skill: you understand why a page looks the way it does, you can fix it when it breaks, and you can answer it in an exam or an interview without help. That is the skill that gets you a job — not a copied answer.

Get certified — just ₹10

Finish all 35 lessons, pass the test (80%), pay ₹10 and get your certificate.

Take the test

Prefer watching? Video courses teach the same topics step by step.

Go further with a full course

Free tutorials teach you the basics. Our paid courses add live projects, mentorship and a certificate.

Ethical Hacking & Cyber Security Workshop
View
Master Python + AI Skills in 30 Days
₹499
View
Summer Training in Python Programming 2026
₹3,000
View
Browse all courses
HTML — Lessons
1. HTML Introduction: What is HTML? Learn with Examples 2. Best Free HTML Editors: Notepad to VS Code for Beginners 3. HTML Basic Structure: Doctype, Head, Body Explained 4. HTML Elements Explained: Tags, Content & Empty Elements 5. HTML Attributes List: href, src, alt, width, title & More 6. HTML Headings h1 to h6: Which Heading Tag to Use When 7. HTML Paragraphs: p Tag, br Line Breaks & pre Text 8. HTML Style Attribute: Colour, Font Size & Alignment 9. HTML Text Formatting Tags: bold, italic, mark & More 10. HTML Comments: How to Add Notes & Hide Code in HTML 11. HTML Colors: Names, HEX, RGB & HSL Colour Codes 12. HTML CSS: Inline, Internal & External Stylesheets 13. HTML Links: a Tag, href, New Tab & Email Links 14. HTML Images: img Tag, src, alt, Width & Formats 15. HTML Favicon: Create & Add a Browser Tab Icon 16. HTML Title Tag: How to Write a Good Page Title 17. HTML Tables: table, tr, th, td, colspan & rowspan 18. HTML Lists: ul, ol, dl & Nested Lists Explained 19. HTML Block vs Inline Elements: div, p, span Explained 20. HTML Div Tag: Group Content & Build Page Layouts 21. HTML Class Attribute: Style Many Elements at Once 22. HTML id Attribute: Unique IDs, Links, CSS & JavaScript 23. HTML Iframes: Embed YouTube, Maps & Pages in HTML 24. HTML JavaScript: script Tag, Clicks & First Example 25. HTML File Paths: Relative vs Absolute Paths Explained 26. HTML Head Element: title, meta, charset & viewport 27. HTML Layout: header, nav, main, footer Page Structure 28. HTML Responsive Design: Viewport, Images & Media Queries 29. Semantic HTML Tags: header, nav, main, article & footer 30. HTML Forms: input, label, select, checkbox & Submit 31. HTML Entities: & < > © with Examples 32. HTML Audio & Video Tags: controls, source & Fallback 33. HTML Accessibility: alt Text, Labels, Landmarks & ARIA 34. HTML Meta Tags & SEO: charset, viewport, OG Tags 35. HTML Quotations: blockquote, q, cite, abbr & address
Final Test — Certificate ₹10

🤖 KAMALDNP AI Assistant

Ask about courses, website & more

Hi! I'm KAMALDNP AI Assistant. Ask me about our courses, website features, or anything else! 😊
Please wait 5s...
🤖 KAMALDNP Assistant ✕

Request human callback:

🔐 Login Required
✕

Please log in to download. You will stay on this page after logging in!

New here? Register now →