Require a specific style for closing void elements
- Rule ID:
- void-style
- Category:
- Style
- Standards:
- -
HTML void elements are elements which cannot have content.
Void elements are implicitly closed (<img>
) but may optionally be XML-style self-closed (<img/>
).
This rules enforces usage of one of the two styles. Default is to omit self-closing tag.
This rule has no effect on non-void elements, see the related rule no-self-closing
.
Rule details
Examples of incorrect code for this rule:
<input/>
Examples of correct code for this rule:
<input>
Options
This rule takes an optional object:
{
"style": "omit"
}
Style
omit
requires end tag to be omitted and disallows self-closing elements (default).selfclosing
requests self-closing all void element.