MyInternships.in

HTML Basics

HTML Layout

A good layout organises a page into meaningful regions like header, navigation, main content, and footer. HTML5 gives you semantic elements that describe each region clearly.


What is an HTML Layout?

An HTML layout is the arrangement of a page into structural regions. In modern HTML you build these regions with semantic elements — tags whose names describe their role, such as <header>, <nav>, <main>, and <footer>.

Before HTML5, developers used generic <div> elements for everything. Semantic elements make the structure obvious to browsers, search engines, and screen readers, which improves both SEO and accessibility.

Basic Usage

The main layout regions
Example
<header>Site title and logo</header>
<nav>Menu links</nav>
<main>Page content</main>
<footer>Copyright</footer>

Example: A Complete Semantic Layout

A full page built from semantic tags
Example
<!DOCTYPE html>
<html>
<body>
  <header style="background:#0d6efd; color:white; padding:16px;">
    <h1>My Website</h1>
    <nav>
      <a href="#" style="color:white;">Home</a> |
      <a href="#" style="color:white;">About</a>
    </nav>
  </header>
  <main style="padding:16px;">
    <article>
      <h2>Blog Post Title</h2>
      <p>The main content of the article goes here.</p>
    </article>
    <aside style="color:#666;">Related links sidebar.</aside>
  </main>
  <footer style="background:#eee; padding:16px;">
    <p>© 2026 My Website</p>
  </footer>
</body>
</html>

More Examples

A two-column layout with flexbox
Example
<!DOCTYPE html>
<html>
<body>
  <div style="display:flex; gap:16px;">
    <main style="flex:3; background:#f5f5f5; padding:16px;">Main content</main>
    <aside style="flex:1; background:#e0e0e0; padding:16px;">Sidebar</aside>
  </div>
</body>
</html>

Semantic Layout Elements

ElementRepresents
<header>Top area: logo, title, intro.
<nav>The main navigation links.
<main>The dominant, unique page content.
<section>A thematic grouping of content.
<article>A self-contained piece, e.g. a post.
<aside>Side content like related links.
<footer>Bottom area: copyright, contact.
💡

Use one <main> element per page and place your primary content inside it. Screen reader users can jump straight to it.

ℹ️

Semantic tags are not magic layout tools — they mark meaning. You still position and size the regions with CSS such as flexbox or grid.

Key Takeaways

  • Semantic elements describe the role of each page region.
  • Use <header>, <nav>, <main>, <aside>, and <footer> for structure.
  • They improve SEO and accessibility over plain <div>s.
  • Combine them with CSS flexbox or grid for visual layout.

Related HTML Topics

Keep learning with these closely related tutorials.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships