How to fix: End tag for "a" omitted, but omittag no was specified

Most Likely Cause and Fix

Your markup is lacking the end tag for an element.

For elements with end tags

Use

<example><a> … </a></example>

instead of

<example><a></example>

For self-closing elements

Use

<example><a … /></example>

instead of

<example><a … ></example>

What This Error Means

This error is telling you that you're missing an end tag in your markup.

A little more specifically, it's telling you that you're missing an end tag on an element that is not allowed to lack an end tag.

Elements that are self-contained and don't directly relate to anything else can do without an end tag (if the version of HTML you're using allows this).

Image elements are self-contained and will usually be fine like this:

<img src="http://example.com/diagram.png" alt="Diagram">

Inline elements that surround content, such as anchors, either require an end tag to be considered valid or should have an end tag to remove ambiguity:

<a href="http://example.com/">Example</a> <!-- This end bit is important -->

How To Fix It

The specific error message you encountered will refer to a line and column number. This will guide you to the exact point in your markup to which the error relates.

For elements with end tags

Use

<example><a> … </a></example>

instead of

<example><a></example>

For self-closing elements

Use

<example><a … /></example>

instead of

<example><a … ></example>

For undefined elements

This error might follow one or more 'element "a" undefined' errors.

Check to see if this is the case.

If so, the <&agt; element is not defined for the version of HTML you are using.

Check the document type declaration used in your markup. Fix this if not correct.

If you're still running into 'element "a" undefined' errors, you're simply using an invalid, undefined element. Don't.

Discuss, Comment and Improve

Did this help you? Can this page be improved? Let us know!

comments powered by Disqus