Validate permitted element parent
- Rule ID:
- element-permitted-parent
- Category:
- Content model
- Standards:
- HTML5
Some elements have restrictions for what parent element they can have.
For instance, the parent of <body>
element must the <html>
element.
This rule does not validate the document root element, e.g. while the <body>
element can only have <html>
as parent if there is no parent at all it is assumed to be valid usage.
Rule details
Examples of incorrect code for this rule:
<div>
<title>Lorem ipsum</title>
</div>
Examples of correct code for this rule:
<head>
<title>Lorem ipsum</title>
</head>
Version history
- 7.4.0 - Rule added.