Skip to main content

HTML Guide

End tag “i” violates nesting rules.

End tag “i” violates nesting rules because the closing </i> does not match the most recently opened still-unclosed inline element, causing mis-nested tags.

HTML requires elements to be properly nested in a stack-like order: last opened, first closed. Inline elements like the i element (for idiomatic text), em, strong, a, and span must not overlap. When you open i and then open b, you must close b before closing i. Mis-nesting often happens around links or emphasis tags, e.g., i inside a but closed outside. The i element is purely presentational/idiomatic; consider em for emphasis or CSS with font-style: italic;, but whichever you use, keep the nesting consistent.

Common patterns that trigger the error:

  • Overlapping inline elements: ib</i></b>
  • Closing order mismatch across a, span, em, strong, i
  • Copy/paste around icons or screen-reader text

Fix by reordering the tags so they close in reverse order of opening, or by merging styles into one element to avoid overlaps.

HTML Examples

Incorrect (reproduces the validator error)

<p>
  <a href="/about"><i>About <strong>Us</i></strong></a>
</p>

Correct (properly nested)

<p>
  <a href="/about"><i>About <strong>Us</strong></i></a>
</p>

Learn more:

Related W3C validator issues