diffsnack
HTML Interactive Find the mistake

Content the browser hides

Some HTML is in the file but not on the screen until something shows it. hidden, <template>, a closed <dialog> and <noscript> all hide content in different ways.

Step by step

  1. By default, hidden hides an element; removing the attribute shows it again.
  2. A normal <template> holds HTML that is not shown; scripts can copy it into the page.
  3. By default, a <dialog> stays hidden until it has open or a script opens it.
  4. Sending a <form method="dialog"> inside a dialog closes the dialog instead of sending data.
  5. <noscript> content is shown only to visitors who have JavaScript turned off.
The card, bug marked
1<section id="newsletter">
2 <h2>Newsletter</h2>
3 <p>New lessons every month.</p>
4 <p id="thanks" hiden>
5 Thanks! Check your inbox.
6 </p>
7</section>
This is how it's right
<p id="thanks" hidden>Thanks!</p>
<template id="gig-row">
<li>Band A</li>
</template>
<dialog open>
<form method="dialog">
<button>OK</button>
</form>
</dialog>
<noscript><p>Turn on JavaScript.</p></noscript>

Exercises for this topic

Key rule

Hidden content is still in the file, so check which attribute or tag hides it and what is meant to show it.

Where you'll meet this

You meet these in sign-up forms, pop-up messages and lists that scripts fill in. <noscript> often holds a fallback message for visitors without JavaScript.

Play this card Next article: Highlights, edits and small text