I would like to know what these Boolean HTML attributes are.
I would like to know what these Boolean HTML attributes are.
Before understanding Boolean attributes in HTML it is crucial to understand how Boolean logic works. Within Boolean logic one can classify things or phenomena as true or false. An example:
Notice that all these questions have only two possible answers: Yes or no. Thus, by making an analogy, Boolean logic would be like what popular wisdom calls "8 or 80" or "is or is not."
Now let's go to the HTML context. In HTML the presence of an attribute is already sufficient to be considered "true", just as its absence means that this attribute receives the value "false". The example below shows how attributes can be used in HTML5:
<audio src="BeeGees.mp3" controls>
</audio>
Notice that the "controls" attribute appears without the assignment command, that is, its presence already indicates that this attribute is set to "true". If you want this attribute to be set to "false", you just have to remove it from the "audio" tag.
In this way, whenever you want an attribute to receive a value of "true", just put it in the tag, when you want it to be false, you just do not declare it.
More information: link
(The code snippet used as an example has been extracted from this link)