Why doesn’t the controls attribute need a value?


#1

Question

Why doesn’t the controls attribute need a value, like all the other attributes we have seen thus far?

Answer

Unlike the other attributes you have seen thus far, the controls attribute is an example of a Boolean attribute. Boolean attributes have true/false conditions. Including a Boolean attribute within an element signifies the condition is true (or on) while omitting it signifies the condition is false (or off).

In this case, including the controls attribute within the opening video tag means “turn the controls on”. We might even say that this is the truthy condition.