Skip to content

Instantly share code, notes, and snippets.

@samme
Last active April 6, 2019 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samme/82133b9849a8d6851104e070b56e0ed3 to your computer and use it in GitHub Desktop.
Save samme/82133b9849a8d6851104e070b56e0ed3 to your computer and use it in GitHub Desktop.
Boolean and boolean-like attributes in HTML

Boolean attributes

The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace. The values "true" and "false" are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.

  • allowfullscreen
  • async
  • autofocus
  • autoplay
  • checked
  • controls
  • default
  • defer
  • disabled
  • formnovalidate
  • hidden
  • ismap
  • itemscope
  • loop
  • multiple
  • muted
  • novalidate
  • open
  • playsinline
  • readonly
  • required
  • reversed
  • scoped
  • seamless
  • selected
  • sortable
  • typemustmatch

Enumerated; as "on", "off"

  • autocomplete (form)

Enumerated; as "true", "false"

  • contenteditable
  • draggable
  • spellcheck

Enumerated; as "yes", "no"

  • translate

Value is optional

  • download

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment