HTML layouts define how page content is structured into areas such as header,
navigation, main content, sidebar, sections, articles, and footer. In this lesson,
you will learn semantic layout elements, layout structure examples, CSS Grid,
Flexbox, responsive layouts, SEO benefits, accessibility tips, and common mistakes.
What Is an HTML Layout?
An HTML layout is the structure of a web page. It decides where important page
parts appear, such as the site header, navigation menu, main content, sidebar,
article sections, and footer.
Modern HTML layouts should use semantic elements for meaning and CSS for visual design.
HTML creates the structure, while CSS Grid, Flexbox, spacing, colors, and responsive
rules control the final layout.
HTML Layouts Cheatsheet
The following table shows the most commonly used HTML layout elements and CSS layout
patterns beginners should know.
Layout Feature
Example
Purpose
Header
<header>Site intro</header>
Defines page or section header content.
Navigation
<nav>Menu links</nav>
Groups main navigation links.
Main Content
<main>Page content</main>
Defines the primary content of the page.
Section
<section><h2>Topic</h2></section>
Groups related content with a heading.
Article
<article>Blog post</article>
Defines independent content.
Aside
<aside>Sidebar</aside>
Defines supporting content or sidebars.
Footer
<footer>Copyright</footer>
Defines footer content.
Generic Wrapper
<div class="container"></div>
Creates layout wrappers when no semantic tag fits.
Flexbox Layout
display: flex;
Creates one-dimensional row or column layouts.
Grid Layout
display: grid;
Creates two-dimensional page layouts.
Basic HTML Layout Structure
A common web page layout includes a header, navigation, main content area,
optional sidebar, and footer.
Semantic layout elements describe the purpose of each page region. They make
your page easier to read, maintain, crawl, and navigate with assistive technology.
<header>: introductory content for a page or section.
<nav>: important navigation links.
<main>: main unique content of the page.
<section>: grouped content with a related topic.
<article>: independent content such as tutorials or posts.
<aside>: sidebar or supporting content.
<footer>: footer information for a page or section.
Two-Column HTML Layout Example
A two-column layout is commonly used for tutorial pages, blogs, documentation pages,
and dashboards. The main content appears on one side, and supporting content appears
in a sidebar.
<main class="page-layout">
<article class="content">
<h1>HTML Layouts</h1>
<p>This is the main tutorial content.</p>
</article>
<aside class="sidebar">
<h2>Related Lessons</h2>
<ul>
<li>HTML Semantic Elements</li>
<li>HTML Forms</li>
<li>HTML Meta Tags</li>
</ul>
</aside>
</main>
CSS Grid is useful for building two-dimensional layouts with rows and columns.
It is commonly used for page shells, dashboards, cards, galleries, and complex
responsive layouts.
A responsive layout adapts to different screen sizes such as mobile phones,
tablets, laptops, and desktop monitors. HTML provides the structure, while CSS
controls how the layout changes across screen widths.
Use the viewport meta tag for mobile-friendly rendering.
Use flexible containers instead of fixed-width layouts.
Use CSS Grid or Flexbox for adaptable layouts.
Use media queries to change layout at smaller screen sizes.
A clear layout helps search engines understand page hierarchy, main content,
navigation, sidebar content, and footer information. It also improves user experience,
which can support better engagement.
Use one clear <main> element for primary content.
Use helpful headings inside sections and articles.
Use navigation links to connect related pages.
Keep important content visible in normal HTML, not hidden in scripts.
Use semantic regions instead of generic wrappers everywhere.
Accessibility Benefits of Good Layouts
Accessible layouts help users move through a page using screen readers,
keyboards, and assistive technologies. Semantic regions make navigation easier.
<header> identifies introductory page content.
<nav> identifies navigation links.
<main> helps users jump to the main content.
<aside> identifies supporting content.
<footer> identifies footer information.
Use aria-label when a page has multiple navigation areas.
Common HTML Layout Mistakes
Using only <div> tags when semantic elements are better.
Using tables for page layout instead of CSS Grid or Flexbox.
Creating fixed-width layouts that break on mobile screens.
Using multiple <main> elements on one page.
Putting sidebar content before main content without a good reason.
Forgetting the viewport meta tag for responsive pages.
Using CSS layout only without meaningful HTML structure.
Key Takeaways
HTML layouts define the structure of a web page.
Use semantic elements like <header>, <nav>, <main>, <section>, <article>, <aside>, and <footer>.
Use CSS Grid for two-dimensional layouts and Flexbox for one-dimensional layouts.
Use responsive CSS and the viewport meta tag for mobile-friendly pages.
Good layouts improve SEO, accessibility, maintainability, and user experience.
Use <div> only when no semantic element fits.
Pro Tip
Use semantic HTML for page meaning and CSS Grid or Flexbox for visual layout.
This keeps your code cleaner, more accessible, more SEO-friendly, and easier to maintain.
You now understand HTML layouts, semantic page regions, layout structure examples,
CSS Grid, Flexbox, responsive design, SEO benefits, and accessibility best practices.