Skip to main content

HTML Tags

HTML <aside> Tag

Written by Updated HTML <aside> Tag exercises

The aside tag holds content that is related to the page but not part of the main story: a sidebar, a "related links" box, a tip, a pull quote. Remove it and the main content still makes complete sense.

That test is the easiest way to decide. If the reader would miss it, it belongs in the main content. If it is extra, it can go in <aside>.

Syntax

html

<aside>
  <!-- Supplementary content like sidebar, notes, ads -->
</aside>

It has no special attributes, only the global ones such as id, class and title.

Example

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Aside Tag Example</title>
  <style>
    main {
      float: left;
      width: 70%;
    }
    aside {
      float: right;
      width: 25%;
      background-color: #f0f0f0;
      padding: 10px;
      border: 1px solid #ccc;
    }
  </style>
</head>
<body>
  <main>
    <h1>Main Content</h1>
    <p>This is the primary content of the webpage. It contains the main article or topic.</p>
  </main>

  <aside>
    <h3>Related Links</h3>
    <ul>
      <li><a href="#">Additional Resource 1</a></li>
      <li><a href="#">Additional Resource 2</a></li>
    </ul>
  </aside>
</body>
</html>

The main article and a "Related Links" box sit side by side. The box is styled to look like a sidebar, but what makes it an aside is the tag, not the position.

Where aside goes

  • Next to the main content, as a page sidebar. Screen readers treat it as a "complementary" landmark, so users can jump straight to it or skip it.
  • Inside an article, for something related to that article only, like a definition box or a quote pulled from the text.

You can use it more than once on a page. Give each one a heading, or an aria-label, so screen reader users can tell them apart.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

Good to know

  • aside is about meaning, not layout. It does not float to the side by itself; you place it with CSS, usually Flexbox or Grid.
  • Do not wrap your main navigation in aside. Navigation has its own tag, <nav>.
  • Ads are a common use, but only put real supplementary content in aside, not parts of the main text.
  • The other layout tags, such as main, header and footer, are covered in semantic layout tags.

HTML <aside> Tag exercises

Add a sidebar

Make the element for content beside the main subject. It holds a link that says Related reading and goes to /related

Result

Check your answer to see it here.