HTML Boolean Attributes

The presence of boolean attribute on html element represents it true and absence of boolean attribute on any html element represents it false.

If the attribute is present in any html element, its value must be empty or the name of the attribute in value of attribute like below:

Possible Correct Syntax:

 

  1. <tag_name attribute_name="attribute_name"></tag_name>
  2. <tag_name attribute_name="attribute_name" />
  3. <tag_name attribute_name=""></tag_name>
  4. <tag_name attribute_name="" />
  5. <tag_name attribute_name></tag_name>
  6. <tag_name attribute_name />

 

Possible Wrong Syntax:

  1. <tag_name attribute_name="true"></tag_name>
  2. <tag_name attribute_name="false"></tag_name>
  3. <tag_name attribute_name="true" />
  4. <tag_name attribute_name="false" />

 

The values “true” and “false” are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.

Here are the some of boolean attribute of HTML elment.

Leave a Reply