About This HTML Issue
The HTML specification is clear on this point: an end tag consists solely of </, the tag name, optional whitespace, and >. No attributes, no values, no extra content of any kind is permitted. This rule applies universally to every HTML element.
This error usually occurs due to one of a few common mistakes:
-
Misplaced attributes: An attribute like
classoridwas accidentally typed on the closing tag instead of (or in addition to) the opening tag. - Copy-paste errors: When duplicating or restructuring code, attributes may end up attached to the wrong tag.
-
Typos or malformed tags: A missing
>on the opening tag can cause the browser or validator to interpret what follows as part of the end tag.
While most browsers are forgiving and will simply ignore attributes on closing tags, this is still a problem. It signals malformed markup that can cause unpredictable behavior in parsers, screen readers, and other tools that process HTML. It also makes your code harder to read and maintain, and it may indicate a deeper structural issue — such as an attribute that was meant to be on the opening tag and is therefore not being applied at all.
Examples
Attribute accidentally placed on the closing tag
This triggers the error because class appears on the </p> end tag:
<p>Welcome to the site.</p class="welcome">
Remove the attribute from the closing tag and place it on the opening tag:
<p class="welcome">Welcome to the site.</p>
Attribute duplicated on both tags
Sometimes attributes appear on both the opening and closing tags:
<div id="sidebar" class="panel">
<p>Sidebar content</p>
</div id="sidebar">
The fix is to remove all attributes from the closing tag:
<div id="sidebar" class="panel">
<p>Sidebar content</p>
</div>
Missing > on the opening tag causing a cascade
A subtle typo on the opening tag can lead to this error. Here, the missing > after the opening <h2 causes the validator to misinterpret the markup:
<h2 class="title"Chapter One</h2>
Adding the missing > fixes the structure:
<h2 class="title">Chapter One</h2>
Multiple elements with the same mistake
This pattern sometimes appears when developers add attributes to closing tags as informal “comments” to track which element is being closed:
<div class="header">
<nav class="main-nav">
<ul>
<li><a href="/">Home</a></li>
</ul>
</nav class="main-nav">
</div class="header">
If you want to annotate closing tags for readability, use HTML comments instead:
<div class="header">
<nav class="main-nav">
<ul>
<li><a href="/">Home</a></li>
</ul>
<!-- .main-nav -->
<!-- .header -->
Find issues like this automatically
Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.