Module 2: HTML Syntax and Attributes
Void Elements
Recognize elements that cannot contain child content and write them without invented closing tags.
Most HTML elements have a start tag and an end tag. A void element cannot contain child content, so it has no end tag. Common examples include img, br, hr, input, meta, link, source, area, base, col, embed, track, and wbr.
<img src="portrait.jpg" alt="Portrait of the author">
<input type="search" name="q">
<hr>
Do not write </img> or place text inside an input. The slash sometimes seen before the closing angle bracket (<img />) is permitted in HTML syntax, but it does not turn the element into an XML-style self-closing element. The slash is unnecessary in normal HTML.
Do not confuse void elements with empty elements. <div></div> is an ordinary element with empty content; it can later contain other elements. A void element cannot.
A line break is also not a substitute for document structure. Use br when a line break is part of the content, such as an address or poem. Use a new paragraph when the next idea is a separate paragraph.