The 25 Boolean Attributes of HTML
Post from May 19, 2020, filed under Web Development.
There are Boolean attributes in HTML, and there are about two dozen of them—25, to be precise, unless I err somewhere. 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.
If you have a question or suggestion about what I write, please leave a comment (if available) or a message.
Have a look at the most popular posts, possibly including:
Perhaps my most relevant book: CSS Optimization Basics (2018). Writing CSS is a craft. As craftspeople we strive to write high quality CSS. In CSS Optimization Basics I lay out some of the most important aspects of such CSS. (Also available in a bundle with Upgrade Your HTML and The Web Development Glossary.)
Looking for a way to comment? Comments have been disabled, unfortunately.