HTML Guide
And end tag has been found that does not match the current open element. Check the context to fix the start and end tags.
Related W3C validator issues
A <p> element cannot be placed inside a <noscript> tag within the <head> section.
According to the HTML specification, the <head> element must only contain metadata, such as <title>, <meta>, <link>, <script>, and <style>. The <noscript> element is allowed in <head>, but it must only contain elements that are valid in head, not flow content like <p>. The <p> (paragraph) tag is flow content meant for the <body>. For fallback content in <head>, only metadata elements are allowed.
Incorrect example:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
<noscript>
<p>JavaScript is disabled.</p>
</noscript>
</head>
<body>
</body>
</html>
Correct approaches:
-
Remove the <p> from <noscript> in <head>:
- If you must include fallback styles or links in case JavaScript is disabled, use only metadata tags.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
<noscript>
<link rel="stylesheet" href="no-js.css">
</noscript>
</head>
<body>
</body>
</html>
-
Place textual fallback content in the <body> instead:
- Moving the <noscript> block with flow content (such as <p>) to the body ensures validity.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example</title>
</head>
<body>
<noscript>
<p>JavaScript is disabled.</p>
</noscript>
</body>
</html>
Remember: Do not use <p> (or any flow content) in <noscript> inside <head>. Use such content only in the body.
An </a> end tag has been found to violate nesting rules. <a> tags can’t include other <a> tags inside. Most probable cause is an unclosed <a> tag, like in this example:
<a href="one.html">Page 1
<a href="two.html">Page 2</a>
An end tag </code> has been found violating nesting rules. Check other errors in the same document related to the <code> element, and fix the unallowed nested elements.
A closing </body> tag has been found, but there are unclosed elements before it. For example this has an unclosed <section> element:
<body>
<section>
</body>
End tags in HTML must not have any attributes.
According to the HTML specification, only start tags (also called opening tags) may contain attributes, while end tags must appear as a plain </tagname> with nothing else.
For example, this is invalid and will trigger the error:
<p>Welcome to the site.</p class="welcome">
Correct code removes the attribute from the end tag:
<p>Welcome to the site.</p>
If you need the element to have an attribute, only include it in the start tag:
<p class="welcome">Welcome to the site.</p>
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: i … b … </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>
An end tag has been found after the closing </body> tag, which breaks the expected HTML document structure.
Check out the document structure, a basic example follows:
<!DOCTYPE html>
<html lang="">
<head>
<title>Test</title>
</head>
<body>
<p></p>
</body>
</html>
An <a> tag can’t include other <a> tags inside. Most probable cause is an unclosed <a> tag, like in this example:
<a href="one.html">Page 1
<a href="two.html">Page 2</a>
A <button> tag can’t include other <button> tags inside. Most probable cause is an unclosed <button> tag, like in this example:
<button>Submit
<button>Cancel</button>
HTML documents are expected to start with a first line containing the Document Type Declaration, that defines the HTML version used. Since HTML5, it’s just <!DOCTYPE html>, which must appear before the start <html> tag.
Here’s an example of a minimal HTML5 document:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
<p></p>
</body>
</html>