Validate element content
- Rule ID:
- element-permitted-content
- Category:
- Content model
- Standards:
- HTML5
HTML defines what content is allowed under each type of element.
Rule details
Examples of incorrect code for this rule:
<!-- <li> is only allowed with <ul> or <ol> as parent -->
<div>
<li>foo</li>
</div>
<!-- interactive elements cannot be nested -->
<button>
<a href="#">Lorem ipsum</a>
</button>
Examples of correct code for this rule:
<ul>
<li>foo</li>
</ul>
<button>
Lorem ipsum
</button>
Version history
- 7.2.0 - Required ancestors moved to new rule
element-required-ancestor
.