What is an empty tag in HTML?

QuestionsQuestions8 SkillsProHTML ImagesNov, 27 2025
0130

An empty tag in HTML is an element that does not have any content between an opening tag and a closing tag. Instead, it is self-contained and typically does not require a closing tag. These tags are often used to insert elements that do not have any inner content, such as images or line breaks.

Examples of empty tags include:

  1. <img>: Used to embed images.

    <img src="image.jpg" alt="Description of image" />
  2. <br>: Inserts a line break.

    <p>This is a paragraph.<br>This is a new line.</p>
  3. <hr>: Creates a horizontal rule (line).

    <hr />
  4. <input>: Used for form inputs.

    <input type="text" placeholder="Enter text here" />

In HTML5, it is common to use a self-closing syntax (e.g., <img />), but the closing slash is optional, so <img> is also valid.

0 Comments

no data
Be the first to share your comment!