Skip to content

void-style

Reports a / at the end of a void element (<br/>, <img />).

A void element has no end tag and the slash is ignored, so it adds nothing; it only suggests the tag is closed like XML, which can mislead a reader about other elements such as <div/>.

To fix, write <br>.

Reported
...
<p style="display: none">ok</p>
<br/>
<br>
...
<svg viewBox="0 0 1 1"><linearGradient gradientUnits="x"></linearGradient></svg>
...
angular:
lint:
rules:
void-style: warn # off (default), warn, error
html:
lint:
rules:
void-style: warn # off (default), warn, error
svelte:
lint:
rules:
void-style: warn # off (default), warn, error
vue:
lint:
rules:
void-style: warn # off (default), warn, error

Enabled by the presets: html/html-validate-recommended, html/htmlhint.

Suppress one line with sudsy-disable-next-line void-style in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
html-validate void-style partial the omit style only, without the style option
htmlhint empty-tag-not-self-closed full