Search code examples
htmlxhtml

Empty Attribute


In HTML, you can have empty attributes, without even ="":

<input type="checkbox" selected></input>

However, in XHTML, you need at least an empty string:

<input type="checkbox" selected="selected"></input>

What is the equivalent of the empty HTML attribute in XHTML? Is it an empty string, or the attribute name as a string, or true, or something else?


Solution

  • https://www.w3.org/TR/xhtml1/#h-4.5

    Equivalent of the empty HTML attribute in XHTML is attribute name.