HTML validation · Document structure

Broken or invalid HTML

The page contains misnested tags, a stray closing tag and an unclosed element, so parsers have to guess what the markup means.

How this page is built

The paragraph below contains three markup errors: bold and italic tags that close in the wrong order, a closing div tag with no matching opening tag, and a span that is never closed.

This sentence has misnested formatting tags, a stray closing tag

and an unclosed span.

Browsers recover from each error, so the paragraph still displays.

Why it matters

Browsers are very good at recovering from broken markup, but each one has to guess what the author meant. Search engines and other tools may guess differently, so content can be split up, nested wrongly or lost.

Serious errors, such as unclosed comments or tags in the wrong place, can hide content or push head tags into the body.

How to check it

Run the page through the W3C Nu HTML Checker, which lists every error with its line number. Many crawl tools can validate pages during a crawl. Focus first on errors that affect structure, such as stray or unclosed tags.

How to fix it

Correct each error so tags open and close in the right order and every element that needs closing is closed.

If the errors come from content editors, check the editor’s output settings. If they come from templates, fix them once at the source.

Back to all tests