freecoding.school100% FREE · NO SIGNUP
The Old NetISSUE #10 of 60

boolean attributes · expanded form

Pixel PeteVSQuirks Mode
Pixel Pete saysBoolean attributes must be written in full expanded form: checked="checked".

HTML lets you write minimized booleans (<input checked>); XML has no concept of attribute minimization, so XHTML requires the full name="name" form: checked="checked", disabled="disabled", selected="selected", readonly="readonly". Verbose, but unambiguous.

Power-ups you unlock

Quirks Mode attacks — common mistakes

Boss battleExpand bare boolean attributes to their full XHTML form.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>invalid: &lt;input type="checkbox" checked&gt;
valid:   &lt;input type="checkbox" checked="checked" /&gt;</pre></body></html>
▶ Open the interactive comic issue
‹ Attribute Values · Always QuotedThe Document Must Be Well-Formed ›