Member-only story

🧑‍🚀 Are HTML’s Self-Closing Tags Discouraged?

9 min readJul 13, 2024

Self-closing custom tags aren’t standardized in HTML for a valid reason. But it’s safe and enouraged to use them with your framework of choice

I must say that lately I learn a lot of new things about web development. One of the interesting things I’ve learned is that, assumingly, self-closing tags are now discouraged.

Hi 👋. My name is Tom Smykowski. I’m a design developer with 20 years of experience.

It immediately triggered some questions like: wait, what?

So, as usual I’ve investigated this topic, so we can all learn something new.

Developers Want Self-Closed Tags In HTML

But let’s start from the beginning. What are self-closing tags? Self-closing tags are HTML tags that doesn’t include explicit closing element, but rather autoclose/selfclose themselves.

For example this tag has an opening and closing:

<div>something</div>

While this tag is self-closed:

<input />

Self-closed tags are just a shorter version of the standard tag when you don’t need to pass content. There’s a short list of…

--

--

Tom Smykowski
Tom Smykowski

Written by Tom Smykowski

Hi! My name is Tom Smykowski, and I’m a Staff Frontend Engineer. Grab a free scalable Angular app checklist: https://tomasz-smykowski.com/scalable-angular

No responses yet