ELEMENTS: Empty Elements

Some tags have no closing tag and are called empty elements. These opening tags can be "closed", simply by adding a space and forward slash:
<br />
<hr />
<img />
Elements without content are also empty elements. There is no content, so browsers just ignore it. The following are samples of empty elements:
<p>   </p>
<h3>   </h3>
<title>  </title>

Notice that the space and slash is after the tagname in singular tags. With paired tags, the slash is before the tagname, without any spaces.


Good habit HTML5 does not require empty elements to be closed. But if you want stricter validation, or you need to make your document readable by XML parsers, you should close all HTML elements. So close your tags. It is just a good habit to get into.
Back button Table of Contents Next button