October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Structure a Webpage with Semantic HTML Elements

Semantic HTML describes a page’s structure and purpose. Learn how to choose the right element—and when a plain div is the better fit.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Semantic HTML means choosing elements for what their content is, not merely for how it should look. Use elements such as <main>, <nav>, <article>, <aside> and <section> to express a document’s structure; use CSS to control its appearance.

What semantic HTML communicates

An element is semantic when its name and role describe the meaning or purpose of its content. A navigation menu belongs in <nav>; the page’s dominant content belongs in <main>. A generic <div>, by contrast, groups content without assigning it a particular document role.

As an Amazon Associate I earn from qualifying purchases.

Semantics give browsers and assistive technologies structural information, and make the markup easier for people to understand and maintain. They do not dictate visual design: CSS can style semantic elements just as it can style generic containers. The WHATWG HTML Living Standard is the normative reference; MDN’s HTML elements reference is a practical guide.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to choose between article, section and aside

Start by asking whether the content can stand on its own, whether it is central or supporting, and whether a more specific element already describes it.

#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
Element Use it for Example
<article> A self-contained composition that could make sense independently. A blog post, news story or comment.
<section> A meaningful, thematic grouping within a document when no more specific element fits. A headed chapter or topic within a longer guide.
<aside> Content related to the surrounding material but not part of its main flow. A related-links box or author biography.

Choose article for independent content

Use <article> when the content forms a distinct composition that could be distributed or understood on its own. A page may contain an article, and an article may contain sections that organize its internal topics.

Choose section for a meaningful grouping

Use <section> when you are grouping related content as a distinct part of a document and no more specific element applies. In ordinary use, give a section a heading so its subject is clear. Do not use it for every box or layout region; use <div> when a grouping has no special semantic purpose.

Choose aside for tangential support

Use <aside> for material that complements the surrounding content rather than carrying its central thread. If the material is essential to the main explanation, it may belong in the main flow instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the other structural elements do

Main identifies the dominant content

<main> identifies the document’s dominant content. The WHATWG defines it this way: “The main element represents the dominant content of the body of a document.” A document must not have more than one <main> without the hidden attribute. See MDN’s main element reference.

Rank #3
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Nav marks navigation

Use <nav> for a section whose purpose is navigation, such as a site menu, table of contents or index. Not every group of links is navigation; choose the element based on the links’ purpose.

Header and footer mark introductory and closing material

<header> and <footer> can belong to the page as a whole or to their nearest relevant sectioning ancestor. They are not restricted to one global header and footer per document.

Headings express hierarchy

Use headings from <h1> through <h6> to label and organize sections according to their hierarchy. Choose a heading level for its place in the document, not as a shortcut for a particular font size; CSS controls sizing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A practical decision process

  1. Identify the content’s purpose. Is it the dominant content, navigation, a standalone composition, tangential support, or a meaningful topic grouping?
  2. Choose the most specific fitting element. For example, use <nav> for navigation rather than a generic container.
  3. Use section only for a real document grouping. Give it a heading in ordinary use; do not use it solely to create a styling hook.
  4. Use a generic container when no semantic role applies. A <div> is appropriate when you need a wrapper for layout or styling without implying a document role.
  5. Style the result with CSS. Let semantics describe the content and CSS determine its appearance.

For example, a guide page might place its main article inside <main>, use <article> for the guide itself, divide the guide into headed <section> elements, and put related resources in an <aside>. A site-wide menu belongs in <nav>. The exact nesting depends on what each part represents, not on how many boxes the design contains.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why semantic structure matters for accessibility

Structural elements can expose implicit landmark regions that help assistive-technology users find major parts of a page. The W3C WAI H101 technique gives semantic elements such as <main> and <nav> as examples of ways to identify page regions. It is a technique example, not a complete accessibility checklist.

Landmarks work best alongside a coherent heading hierarchy and link text that describes its destination. Semantic HTML contributes useful navigation cues, but using structural elements alone does not make every aspect of a page accessible. MDN’s document-structure learning material explains how headings and landmarks help users navigate content.

Common semantic HTML mistakes

  • Using section as a universal wrapper: choose it for a meaningful document grouping, not simply because a block needs styling.
  • Confusing independence with grouping: use <article> for a composition that can stand alone; use <section> for a distinct part of a larger document.
  • Treating aside as a visual sidebar: its meaning is tangential supporting content, not its position on the screen.
  • Using headings for visual size: select heading levels by document hierarchy and adjust appearance with CSS.
  • Assuming semantics guarantee accessibility: landmarks and headings help, but their value depends on appropriate use and a clear structure.

Where to check element details

For normative definitions and behavior, consult the WHATWG HTML Living Standard. For quick element-by-element explanations, use MDN’s HTML elements reference, including its entries for section and main.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.