Require elements with optional end tags to be explicitly closed
- Rule ID:
- no-implicit-close
- Category:
- Style
- Standards:
- HTML5
Some elements in HTML has optional end tags. When an optional tag is omitted a browser must handle it as if the end tag was present.
Omitted end tags can be ambiguous for humans to read and many editors have trouble formatting the markup.
Rule details
Examples of incorrect code for this rule:
<ul>
<li>foo
<li>bar
<li>baz
</ul>
<p>lorem ipsum
<p>dolor sit amet
<p>
<div>lorem ipsum</div>
</p>
Examples of correct code for this rule:
<ul>
<li>foo</li>
<li>bar</li>
<li>baz</li>
</ul>
<p>lorem ipsum</p>
<p>dolor sit amet</p>