HTML 4 Empty Elements
Most HTML elements are constructed with an opening and closing tag pair - but there are some which place the element content within a single tag and these elements
are known as empty elements. As an example the element instructing the browser to insert a line break is written as
Elements are defined as empty when they contain no content or text of their own for immediate display on the page. Empty elements broadly fall into three categories.
- formatting elements - these are
<br>which instructs the browser to insert a line-break (start a new line) and
<hr>which tells the browser to insert a horizontal rule into the document - a straight line drawn across the screen.
- placeholder elements comprising
<link>which are containers for content which comes from an external source and which is not part of the page code.
- non-display information - the last group,
<param>contain information the browser may need but which isn't displayed on the screen.
Here is a list of the empty elements in the HTML 4 specification along with a link to pages giving individual definitions and usage examples:
NOTE: This empty element syntax is valid using HTML but if you are using XHTML you need to add a space and forward slash
/ following the element name surrounded by the usual less than and greater than signs
<> which gives you:
<br />. Please have a look at the HTML vs. XHTML page for further information on the
differences between HTML and XHTML.