The 24 Boolean Attributes of HTML
Published on May 19, 2020 (↻ January 27, 2024), filed under Web Development (RSS feed for all categories).
There are Boolean attributes in HTML and, unless I err somewhere, there are two dozen of them. Here’s a quick rundown of what makes for a Boolean attribute, and what Boolean attributes there are in current HTML.
What is a Boolean at all? Citing the The Web Development Glossary, a Boolean is “a data type that has one of two possible values (usually denoted true and false).”
What is a Boolean attribute? A Boolean attribute is an attribute that can only be true or false.
How does a Boolean attribute work? According to the HTML specification:
The presence of a boolean attribute on an element represents the “true” value, and the absence of the attribute represents the “false” value.
Yet note:
The values “true” and “false” are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.
So, what Boolean attributes are there?
The Boolean Attributes
allowfullscreen
async
autofocus
autoplay
checked
controls
default
defer
disabled
formnovalidate
inert
ismap
itemscope
loop
multiple
muted
nomodule
novalidate
open
playsinline
readonly
required
reversed
selected
Yes. That’s it.
Update (October 21, 2022)
The list now strictly follows the HTML specification’s attributes overview. That means it doesn’t contain Boolean attributes found on legacy and obsolete elements anymore, like truespeed
.
About Me
I’m Jens, and I’m an engineering lead and author. I’ve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, I’m close to W3C and WHATWG, and I write and review books for O’Reilly and Frontend Dogma.
With my current move to Spain, I’m open to a new remote frontend leadership position. Feel free to review and refer my CV or LinkedIn profile.
I love trying things, not only in web development, but also in other areas like philosophy. Here on meiert.com I share some of my views and experiences.
Read More
Maybe of interest to you, too:
- Next: On Disclosing Our Salaries
- Previous: 5 Tips to Get Your Dev Blog Running
- More under Web Development
- More from 2020
- Most popular posts
Looking for a way to comment? Comments have been disabled, unfortunately.
Get a good look at web development? Try WebGlossary.info—and The Web Development Glossary 3K (2023). With explanations and definitions for thousands of terms of web development, web design, and related fields, building on Wikipedia as well as MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.