Skip to main content
The HTML Tags Checker provides a simple, intuitive interface for validating whether one HTML tag can contain another according to W3C standards.

Using the Validator Form

The validator consists of two input fields and a validation button:
1

Enter the parent tag

Type the parent HTML tag name in the Parent Tag field. For example, div, p, or button.
Enter only the tag name without angle brackets. Use div instead of <div>.
2

Enter the child tag

Type the child HTML tag name in the Child Tag field. This is the tag you want to nest inside the parent.
3

Click Validate

Click the Validate button to check if the nesting combination is valid according to HTML5 standards.

Understanding Validation Results

After clicking Validate, you’ll receive one of three result types:
A green checkmark (✓) indicates the nesting is valid according to HTML5 standards.Example:
<div>
  <p>Sample content</p>
</div>
The result includes:
  • A clear “Allowed” message
  • Explanation of why this combination is valid
  • Code example showing proper usage

Validation Messages

The validator provides detailed, context-specific messages explaining why a combination is or isn’t allowed:

Common Valid Scenarios

  • Block elements containing others: “The <div> tag is a block element and can contain block or inline elements like <p>.”
  • Inline elements with inline content: “The <span> tag is an inline element and can contain other inline elements like <strong>.”
  • Specific allowed rules: “The <ul> tag can contain <li> according to specific HTML5 rules.”

Common Invalid Scenarios

  • Void elements as parents: “The <img> tag is a void element and cannot contain child elements.”
  • Block in inline: “The <span> tag is an inline element and cannot contain block elements like <div> according to HTML5 standards.”
  • Interactive nesting restrictions: “The <button> tag cannot contain block elements like <div> according to HTML5 standards.”

Code Examples

Every validation result includes a code example showing:
<parentTag>
  <childTag>Sample content</childTag>
</parentTag>
These examples demonstrate proper usage you can copy into your projects.
<!-- This is not valid according to HTML5 standards -->
<parentTag>
  <childTag>Sample content</childTag>
</parentTag>
These examples are marked with comments to warn against their use.

URL Parameters

You can share specific validations using URL parameters:
index.html?parent=div&child=p&lang=en
The validator automatically:
  • Loads the specified parent and child tags
  • Sets the language preference
  • Runs the validation immediately
  • Updates the URL when you validate new combinations
This makes it easy to share validation results with team members or bookmark frequently-checked combinations.

Viewing Nesting Rules

Click the View nesting rules button to access a comprehensive guide covering:
  • Element categories (block, inline, void)
  • Specific nesting rules by element type
  • Best practices for valid HTML
  • Common patterns to avoid
  • W3C validation tool links
This reference guide provides in-depth documentation without leaving the validator interface.

Build docs developers (and LLMs) love