297/361

What are empty elements in HTML?

Quiz · HTML
Medium
3 min
html

Empty elements in HTML are elements that do not contain any content between their opening and closing tags. Instead, they are self-closing tags, meaning they have a forward slash (/) before the closing angle bracket (>). Some common examples of empty elements include:

  • <img>: Used to embed images into the document.
  • <input>: Used to accept user input.
  • <br>: Used to insert line breaks or forced line breaks.
  • <hr>: Used to create horizontal rules or separators.

Adapted from the Front End Interview Handbook by Yangshun Tay and contributors (MIT License). Source

Spotted a mistake or a rights concern? Report an issue