Void elements

Void elements are a special kind of element that must not have content. That’s a big difference to other elements that can be empty but can also contain other elements and text (such as <div> s).

The most known void elements are:

<br> <hr> <img> <input> <link> <meta>

The lesser known are:

<area> <base> <col> <command> <embed> <keygen> <param> <source> <track> <wbr>

That’s it. Those are all of the existing void elements.

It is not, and has never been, valid HTML to write <br></br> , since this would imply that the br element accepts content (writing <br>Hello!</br> has absolutely no meaning). However, it is very common to see both <br> and <br /> .

Although most people know that in XHTML it is mandatory to write <br /> the rules for HTML are less obvious.

History

To completely understand the rules of void elements a bit of history is necessary.

HTML, XML and X(HT)ML are all based on SGML, the Standard Generalized Markup Language which has been crafted in 1986.

HTML and XML derived directly from SGML. XML is a more restrictive subset of SGML and that’s what XHTML is based on.

XHTML is basically the same as HTML but based on XML.

So far so good? Then lets get to the interesting part:

SGML has a feature called NET (Null End Tag). This is a short notation to avoid having to close a tag when the content of your element is simple text. With NET you can write <quote/Quoted text/ instead of <quote>Quoted text</quote> .