What are void (self-closing) elements in HTML?
Void elements are tags that hold no content and therefore need no closing tag — <img>, <br>, <input> and friends.
Most HTML elements come in pairs (<p>...</p>), but some represent a single thing that has nothing "inside" it — a line break, an image reference, a piece of metadata. These are void (also loosely called self-closing) elements, and writing a closing tag for them would be meaningless. The ones you'll meet regularly:
| Element | Purpose |
|---|---|
<br> |
Line break |
<hr> |
Horizontal rule |
<img> |
Image |
<input> |
Form input field |
<meta> |
Metadata |
<link> |
Link to an external resource (e.g. a stylesheet) |
<source> |
A media source for <video> or <audio> |
All three of these forms are accepted and render identically:
<br>
<br/>
<br />
The trailing slash is a small history lesson: in XHTML (a stricter, XML-based variant) it was required, so older code and habits often include it. In modern HTML5 it is purely optional and has no effect — so <br> and <br/> are exactly the same thing.
Go deeper:
Void element — MDN Glossary — the full list of void elements and why "self-closing" tags don't really exist in HTML.