kb/data/developer.mozilla.org/en-US/docs/Glossary/Boolean/HTML-0.md

11 KiB

title chunk source category tags date_saved instance
Boolean attribute (HTML) - Glossary | MDN 1/3 https://developer.mozilla.org/en-US/docs/Glossary/Boolean/HTML reference web, html, css, javascript, documentation 2026-05-05T05:25:32.775095+00:00 kb-cron

MDN HTML HTML: Markup language

HTML reference

HTML guides

Markup languages

CSS CSS: Styling language

CSS reference

CSS guides

Layout cookbook

JavaScriptJS JavaScript: Scripting language

JS reference

JS guides

Web APIs Web APIs: Programming interfaces

Web API reference

Web API guides

All All web technology

Technologies

Topics

Learn Learn web development

Frontend developer course

Learn HTML

Learn CSS

Learn JavaScript

Tools Discover our tools

About Get to know MDN better

Blog

  1. Glossary
  2. Boolean
  3. Boolean attribute (HTML)

Boolean attribute (HTML)

A boolean attribute in HTML is an attribute that represents true or false values. If an HTML tag contains a boolean attribute — no matter the value of that attribute — the attribute is set to true on that element. If an HTML tag does not contain the attribute, the attribute is set to false. If the attribute is present, it can have one of the following forms:

  • the attribute name alone; e.g., attribute, meaning its implicit value is the empty string
  • the attribute with a value of the empty string; e.g., attribute=""
  • the attribute with a value of the attribute's name itself, with no leading or trailing whitespace and case ignored; e.g., attribute="attribute", attribute="ATTRIBUTE"

Note: The strings "true" and "false" are invalid values. To set the attribute to false, the attribute should be omitted altogether. Though modern browsers treat any string value as true, you should not rely on that behavior. Here's an example of a HTML boolean attribute checked:

In this article

See also