HTML5 Empty or Void elements
Most of the HTML elements have a start and an end tag that
indicate where the element begins and where it ends. There is a group of
elements that don’t have end tags. These elements are called empty or void and
only have a start tag since they can't have any content. They must not have
an end tag in HTML.
So, to summarize:
- An empty element is one that has no content, regardless of whether it is allowed to have content in the first place.
- A void element is one that cannot have any content.
The void elements in HTML 4.01/XHTML 1.0 Strict are as follows:
|
<input>
<link>
<meta>
<param>
|
HTML5
currently adds:
To create a button with the input element, do this if you use an
XHTML doctype:
And this for HTML:
Both are valid if you use HTML5.
Do not use end tag:
<!— Not valid! -->