The 24 Boolean Attributes of HTML
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.
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
Yes. That’s it.
Update (October 21, 2022)
I’m Jens, and I’m an engineering lead—currently manager for Developer Experience at LivePerson—and author. I’ve worked as a technical lead for Google, I’m close to W3C and WHATWG, and I write and review books for O’Reilly. I love trying things, sometimes including philosophy, art, and adventure. Here on meiert.com I share some of my views and experiences.
If you have a question or suggestion about what I write, please leave a comment (if available) or a message. Thank you!
Maybe this is interesting to you, too:
- Next: On Disclosing Our Salaries
- Previous: 5 Tips to Get Your Dev Blog Running
- More under Web Development, or from 2020
- Most popular posts
Looking for a way to comment? Comments have been disabled, unfortunately.
Get a good look at web development? Try The Web Development Glossary (2020). With explanations and definitions for literally thousands of terms from Web Development and related fields, building on Wikipedia as well as the MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.