As formally defined, HTML 4 does not allow attributes without a value. What is usually regarded as an attribute without a value, as in <input checked> , is formally the value of an attribute without an attribute name (and an equal sign). Although they are mistakenly described as “logical attributes” with special minimization rules in the HTML 4 specifications, these specifications normatively refer to the SGML standard.
In the SGML standard, whenever an attribute is declared by listing keywords that are the only valid values, the specification of an attribute can, under certain conditions, be minimized to a value. This means that in HTML 4 the <input checkbox> tag is valid; attribute is a minimized form of type=checkbox . No browser supports this (they parse the checkbox as an attribute name), but the construct passes in the validators.
In practice, part of the attribute minimization rules supported by browsers consists of only special cases when an attribute is declared as allowing only one keyword value, for example, the checked attribute, which is formally declared using p>
<!ATTLIST INPUT checked (checked) #IMPLIED>
So it depends on how the attribute is declared in the HTML 4 specification.
But that means that the minimized checked attribute means checked=checked . The value is not empty, but the checked keyword. Browsers, on the other hand, consider attributes such as “presence attributes”: it matters whether the element has this attribute or not, and not its value.
In HTML5, serialized as XHTML (i.e., as XML), everything is simple: each attribute specification must be of the form name = "value" or name = 'value', so an equal sign is required, and therefore, quotation marks; logically, the value is always present, although it may be an empty string, as in alt="" .
In HTML5, serialized as HTML, some attributes are defined so that the attribute value (and the equal sign) is not required. Rather confusing, they are attributes declared as “logical attributes” (they are confusing, for example, because true and false not allowed, but this name partially reflects the principle that the corresponding DOM property or IDL attribute “as they call it, have true and false values as the only valid values.) For such attributes, by definition, the value is not even significant; only the presence of the attribute matters. For example, for the checked attribute, the value is not used, but if the value is set, it must be either an empty string ( checked="" ), or identical to the attribute name if the case is case insensitive (for example, checked=checked ), Any other value is inappropriate, but should work with the same value (for example, checked=false means the same, as checked ).
For a specific example, it is not valid in any version of HTML since the section attribute is not declared.