(Why) Some HTML is “optional”

Avatar of Robin Rendle
Robin Rendle on

Find and fix web accessibility issues with ease using axe DevTools Pro. Try for free!

Remy Sharp digs into the history of the web and describes why the <p> tag doesn’t need to be closed like this:

<p>Paragraphs don’t need to be closed
<p>Pretty weird, huh?

Remy writes:

Pre-DOM, pre-browsers, the world’s first browser was being written by Sir Tim Berners-Lee. There was no reference implementation and certainly no such thing as a parsing specification. The first browser, the WorldWideWeb.app, parsed HTML character by character applying styles as it went along. As opposed to today’s methods whereby a document object model is built up, then rendered.

[…] The paragraph tag (yes, in upper case) was intended to separate paragraphs, not wrap them.

Paragraph one.
Paragraph two.
Paragraph three.

Weird, huh! Remy wrote this in response to Chris’ post the other day about optional HTML and how browsers will close certain tags for us or even insert the right elements in place.

Direct Link →