Closing One-Off Tags in HTML5?

I wasn’t sure whether I needed to close my meta tags in HTML5. And br tags, for that matter. People call them one-off tags, unpaired tags, self-closing, monotags, bachelor tags, among others.

They’re called void elements.

According to W3C, the void elements are: area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, wbr.

Under “8.1.2 Elements”:

Void elements can’t have any contents (since there’s no end tag, no content can be put between the start tag and the end tag).

Under “ Start tags” it says:

Then, if the element is one of the void elements, or if the element is a foreign element, then there may be a single “/” (U+002F) character. This character has no effect on void elements, but on foreign elements it marks the start tag as self-closing.

So, “/>” has no effect on a meta tag. Or any other void element. But it is not invalid to put it there.

About Jeff Fitzsimons

Jeff Fitzsimons is a software engineer in the California Bay Area. Technical specialties include C++, Win32, and multithreading. Personal interests include rock climbing, cycling, motorcycles, and photography.
This entry was posted in Technology. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *