Jens Oliver Meiert

On the Difficulty of Counting the Number of HTML Elements

Post from January 17, 2022 (↻ January 28, 2022), filed under .

How many HTML elements are there?

What looks like a fairly simple question, isn’t one:

The answers to these questions lead to different answers about the number of HTML elements.

Many people may want to know the number of HTML elements as per the current specification. That still leaves the question how they treat SVG and MathML as well as custom elements. Custom elements are not countable and should probably be ignored. If <svg> and <math> are considered elements of their respective specifications, as of today, the answer is 112; if <svg> and <math> are considered HTML elements, 114.

If you’re looking for the number of HTML and XHTML elements formally specified, the answer is 131 or 133, that is, without or with <svg> and <math>. (I maintain an HTML elements index that makes this easy to tell.)

If you’re looking for all elements specified in HTML 1, it’s 22 elements; in HTML 2.0, 49 elements; in HTML 3.2, 70 elements; in HTML 4.01, 91 elements; in (unofficial) HTML 5.2, 111 elements. In XHTML 1.0, 91 elements; but in XHTML 1.1, a “strict” spec, 83 elements.

You notice that the answer to the number of HTML elements isn’t actually difficult; it only needs qualification because there isn’t one number of HTML elements. When you talk about the number of HTML elements, make clear what you’re including and excluding; and when you’re reading about it, check on what the author is including and excluding. This way, you avoid all difficulty and inaccuracy.

If you’re curious about all the HTML elements, check out aforementioned HTML elements index! It’s up-to-date—and when you find a mistake, I’m happy to stand corrected and might pay or donate for the correction.

Tweet this? (If it changed your life, you delight me with a coffee.)

About Me

Jens Oliver Meiert, on April 29, 2020.

I’m Jens Oliver Meiert, and I’m an engineering manager and author. I’ve worked as a technical lead for Google, I’m close to the W3C and the WHATWG, and I write and review books for O’Reilly. Other than that, I love trying things, sometimes including philosophy, art, and adventure. Here on meiert.com I share some of my views and experiences.

If you have questions or suggestions about what I write, please leave a comment (if available) or a message.

Read More

Have a look at the most popular posts, possibly including:

Looking for a way to comment? Comments have been disabled, unfortunately.

Cover: The Web Development Glossary.

Perhaps my most comprehensive book: The Web Development Glossary (2020). With explanations and definitions for literally thousands of terms from Web Development and related fields, building on Wikipedia as well as the MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.

Stay up-to-date? Follow me by feed or on Twitter.

Found a mistake? Email me, jens@meiert.com.

You are here: HomeArchive2022 → On the Difficulty of Counting the Number of HTML Elements

Last update: January 28, 2022

Professional frontend developers produce valid HTML and CSS.