List of HTML Self-Closing Tags

, , …,
Want to master JavaScript in a week? Example based, to the point. Xah JavaScript Tutorial.

This page is a list of HTML elements that do not have a closing tag. They are also called {self-closing tag, empty tag, void element, singleton tag}.

html close all the tags cartoon

Here's a complete list of self-closing tags for HTML5.

<area />
<base />
<br />
<col />
<command />
<embed />
<hr />
<img />
<input />
<keygen />
<link />
<meta />
<param />
<source />
<track />
<wbr />

The space before the slash is optional.

For a list of all HTML5 tags, see: HTML5 Tags.

Is the Ending Slash Optional?

I'd recommend to always add the slash. Because, it provides a visual clue of non-closing tags. It's also technically superior, because if you write scripts to check your HTML, you don't need a lookup table to check which tags doesn't need to be closed.

XHTML Supports Self-Closing Syntax for All Tags

In XML/XHTML, every tag can be self-closed by the ending slash <… />. When you test it, you have to make sure the server is sending the correct Internet media type as XHTML (⁖ application/xhtml+xml), otherwise browsers will treat it as HTML, regardless of the DOCTYPE in your file.

I do NOT recommend self-closing for normal tags.


Back to HTML5 Tags.

blog comments powered by Disqus