There are many things programmers believe about HTML that are not necessarily true. Here’re some. assets/thumbnail-551A8B-D1D9EC-000000.png

Web is beautiful. Web is ugly. Web is astonishing. A part of this appeal is HTML, with its historical quirks. Many a programmer believe many things about HTML. And some of the beliefs are not necessarily true. So let’s explore some falsehoods programmers believe about HTML.

Language & Parsing

Some tags (like or ) have implicit closing tags:

<li> List item without closing tag
<li> Another list item right after it
tag>

and are self-closing:

<!-- Notice the / here!-->
<input type=text/>
tag>

and don’t even need a self-close slash.

Actually, self-close slash is mostly optional (and discouraged) in HTML, so the difference is less pronounced.

Standard

It’s defined by browser vendors and WHATWG (= browser vendors)

The standard is "Living", and you can see (a very recent) date of last change at Living Standard page.

HTML is also relating to a group of standards, including DOM and JavaScript. In fact, many features of HTML are defined as JavaScript classes.

Oh my sweet summer child...

LT()!DOCTYPE html>
LT()!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
LT()!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
LT()!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Level 1//EN">
LT()!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Level 2//EN">
LT()!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict//EN">
LT()!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 1//EN">
LT()!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
LT()!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
LT()!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
LT()!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
LT()!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
LT()!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
LT()!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
LT()!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
LT()!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
LT()!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
LT()!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">

Practices

ePub, a widespread ebook format, uses XHTML for content markup. It sucks, but it’s a practice.

ePub 3.3 uses HTML5, but still.

Runtime

React propaganda is probably to blame for this illusion. DOM is the most optimized data structure out there. Whatever you put in it—it’ll sustain. React will not.

Browsers are JS evaluators. Browsers are layout engines. Browsers are computer graphics toolkits (WebGL and fonts). Browsers are OSes (they have file system interfaces, audio output, and many other APIs).

Not really if you write simple semantic HTML. Because it’s easy to parse and index, especially compared to JS-generated markup.

These are different niches. You can’t really make accessible websites with WebAssembly. So if you want universal pages openable everywhere, you have to stick with HTML etc.

It is, given CSS and user input.

Did I Forget Any?

In case you haven’t found your favorite falsehood, feel free to suggest more! This post will likely be on Reddit and Hacker News, so use comments there. Or use the contacts from the About page!