TIL: The case against self-closing tags in HTML

· ? cm

Self-closing tags (e.g. <br />) are not a thing in HTML.

The browser already knows which elements are self-closing and simply ignores the /> part.

See also the W3C validator’s documentation on this, which says that trailing slashes in void-element start tags do not mark the start tags as self-closing

Or get it straight from the HTML Standard, §13.1.2.1 Start tags:

On void elements, [the trailing slash] does not mark the start tag as self-closing but instead is unnecessary and has no effect of any kind.

See The case against self-closing tags in HTML.