Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

HTML <aside> hidden Attribute

A hidden attribute on an <aside> tag hides the aside.

Although the aside is not visible, its position on the page is maintained.

Example

#

A hidden attribute on an <aside> tag.
The aside element (on the right side) is not visible.

Art appreciation classes are
available in these cities:
  • Amsterdam
  • London
  • Paris
  • Rome
  • Berlin
  • New York
  • Houston
  • Los Angeles
<div style="display: flex;">
 <main>
   Art appreciation classes are<br />
   available in these cities: 
   <ul>
     <li>Amsterdam</li>
     <li>London</li>
     <li>Paris</li>
     <li>Rome</li>
     <li>Berlin</li>
     <li>New York</li>
     <li>Houston</li>
     <li>Los Angeles</li>
   </ul>
 </main>
 
 <aside hidden style="padding:80px;">
  <i>For the cheapest flights<br />
  please contact our travel<br />
  partner KLM.</i>
 </aside>
</div>

Using hidden

The hidden attribute hides the <aside> element.

You can specify either 'hidden' (without value) or 'hidden="hidden"'. Both are valid.

A hidden <aside> element is not visible, but it maintains its position on the page.


Syntax

<aside hidden>
or
<aside hidden="hidden">

Values

#

Value Description
hidden Use 'hidden' or hidden='hidden'. Both are valid.

More Examples

Clicking the button toggles A hidden attribute on the <aside> element.

Art appreciation classes are
available in these cities:
  • Amsterdam
  • London
  • Paris
  • Rome
  • Berlin
  • New York
  • Houston
  • Los Angeles

<div style="display: flex;">
 <main>
   Art appreciation classes are<br />
   available in these cities: 
   <ul>
     <li>Amsterdam</li>
     <li>London</li>
     <li>Paris</li>
     <li>Rome</li>
     <li>Berlin</li>
     <li>New York</li>
     <li>Houston</li>
     <li>Los Angeles</li>
   </ul>
 </main>
 
 <aside style="margin:60px;padding:20px;background:aliceblue;" id="aside">
   <i>For the cheapest flights<br />
   please contact our travel<br />
   partner KLM.</i>
 </aside>
</div>

<br />
<button onclick="toggle(this);">Hide Aside</button>

<script>
  let toggle = button => {
    let element = document.getElementById("aside");
    let hidden = element.getAttribute("hidden");

    if (hidden) {
       element.removeAttribute("hidden");
       button.innerText = "Hide Aside";
    } else {
       element.setAttribute("hidden", "hidden");
       button.innerText = "Show Aside";
    }
  }
</script>

Code explanation

Clicking the button invokes a JavaScript function that adds or removes the hidden attribute.

When the hidden attribute is present it hides the <aside> element.


Browser support

Here is when hidden support started for each browser:

Chrome
6.0 Sep 2010
Firefox
4.0 Mar 2011
IE/Edge
9.0 Mar 2011
Opera
11.1 Mar 2011
Safari
5.0 Jun 2010

You may also like

 Back to <aside>
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

Guides