HTML Tags Checker is a web-based validation tool designed to help developers verify whether one HTML tag can properly contain another according to W3C standards. Built specifically for students and developers learning HTML, this tool provides instant feedback on tag nesting rules with clear explanations and code examples.
This project was created by aprendoeasy.com for the KidCoder programming courses, launching in 2026.
The core validation function (canContain) follows this decision tree:
1
Check for void parent elements
If the parent is a void element (like <img> or <input>), it cannot contain any children.
if (parentType === 'void') { return { valid: false, message: "The <{parent}> tag is a void element and cannot contain child elements." };}
2
Check for void child elements
If the child is a void element, it can be placed almost anywhere.
if (childType === 'void') { return { valid: true, message: "The <{parent}> tag can contain the void element <{child}>." };}
3
Apply specific rules
Check if the parent has specific nesting rules defined in specificRules.
if (parentType === 'specific') { const allowedTypes = htmlNestingRules.specificRules[parentTag]; // Check if child tag or child type is allowed if (allowedTypes.includes(childTag) || allowedTypes.includes(childType)) { return { valid: true, ... }; }}
4
Apply general rules
Fall back to general block/inline rules:
Block elements can contain block or inline elements
Ready to start using the HTML Tags Checker? Check out the Quickstart Guide to download and run the tool, or explore the comprehensive nesting rules built into the validator.