HTML’s best kept secret: the <output> tag
I prefer using built-in, semantic HTML whenever possible. Here’s Den Odell with a tag I didn’t realise existed:
Every developer knows
<input>. It’s the workhorse of the web.But
<output>? Most have never touched it. Some don’t even know it exists.That’s a shame, because it solves something we’ve been cobbling together with
<div>s and ARIA for years: dynamic results that are announced to screen readers by default.It’s been in the spec for years. Yet it’s hiding in plain sight.
[…]
Usage is straightforward:
<output>Your dynamic value goes here</output>
Check out Den’s post for nuance and real-world examples. There is also a Hacker News discussion.