HTML Concepts: Kinds of Elements

Published on May 31, 2023, filed under (RSS feed for all categories).

There are six (not two, five, or eight) different kinds of elements in HTML:

  1. Void elements: area, base, br, col, embed, hr, img, input, link, meta, source, track, and wbr
  2. Raw text elements: script and style
  3. Escapable raw text elements: textarea and title
  4. The template element: template
  5. Foreign elements: elements from the MathML and SVG namespaces
  6. Normal elements: all other allowed HTML elements

This classification is useful because these elements differ in key aspects. Void elements have no contents (they have no end tag, even if we wanted one). The template element contains template contents. MathML and SVG relate to different specifications (and may therefore not even be counted as HTML elements).

As always (consider the Web Developer’s Pilgrimage), the HTML specification has the details: § 13.1.2 Elements. And this is part of a series: more HTML concepts.

Was this useful or interesting? Share (toot) this post, or maybe treat me to a coffee. Thanks!

About Me

Jens Oliver Meiert, on September 30, 2021.

I’m Jens, and I’m an engineering lead and author. I’ve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, I’m close to W3C and WHATWG, and I write and review books for O’Reilly and Frontend Dogma.

With my current move to Spain, I’m open to a new remote frontend leadership position. Feel free to review and refer my CV or LinkedIn profile.

I love trying things, not only in web development, but also in other areas like philosophy. Here on meiert.com I share some of my views and experiences.