A collection of lesser known HTML Features

Discover lesser-known HTML features like `<details>`, `<dialog>`, `<meter>`, and attributes such as `download` and `spellcheck` to enhance web interactivity and accessibility without JavaScript.

Lesser-known HTML features worth using

<details> and <summary> This gives you a disclosure widget. It needs no JavaScript:

<details>
  <summary>More info</summary>
  Hidden content here.
</details>

<dialog> This gives you native modal dialogs and popups:

<dialog id="myDialog">Hello!</dialog>
<button onclick="myDialog.showModal()">Open</button>

input attributes: pattern, min, max, step, and list These enable client-side validation. They also enable custom input options:

<input type="text" pattern="[A-Za-z]{3,}" title="At least 3 letters">
<input type="number" min="1" max="10" step="2">
<input list="browsers">
<datalist id="browsers">
  <option value="Chrome">
  <option value="Firefox">
</datalist>

<output> This shows calculation results from forms:

<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
  <input type="number" id="a"> +
  <input type="number" id="b"> =
  <output name="result" for="a b"></output>
</form>

<meter> and <progress> These show measurements and progress bars:

<meter value="0.7">70%</meter>
<progress value="60" max="100"></progress>

hidden attribute This removes an element from view. It also removes it from the accessibility tree:

<div hidden>This is hidden</div>

download attribute on links This downloads a file. You can set a custom filename:

<a href="file.pdf" download="customname.pdf">Download</a>

spellcheck attribute This turns spell checking on or off for an element:

<textarea spellcheck="false"></textarea>

Form attributes: autofocus, autocomplete, required, readonly, multiple These improve the experience of filling in forms.

All of these work without JavaScript. Or almost without it.