HTML and CSS Reference
Replace Empty Tag with Empty-Element Tag
Change elements such as <br> to <br class='empty' /> .
You shall do marvelous wisely, good Reynaldo,<br>
Before you visit him, to make inquire<br>
Of his behavior.<br>
Polonius<hr class='empty' />
You shall do marvelous wisely, good Reynaldo,<br class='empty' />
Before you visit him, to make inquire<br class='empty' />
Of his behavior. <br class='empty' />
XML parsers require that every start-tag have a matching end-tag. There can be no <p> without a corresponding
</p> . Similarly, there can be no <br> without a corresponding </br> . Alternatively, you can use empty-element
tag syntax, such as <br/> and <hr/> . This is usually simpler for elements that are guaranteed to be empty and
more compatible with legacy browsers.
Although most modern browsers have no problem with empty-element tags, a few older ones you'll still find
installed here or there, such as Netscape 3, do. For example, some will treat <br/> as an element whose name
is br/ and will not insert the necessary break. Others will take <br></br> as a double break, rather than a
single break. The content will still be present, but it may not be styled properly.
Classic HTML defines 12 empty elements: