Self-closing tags, also known as single tags, are HTML elements that do not require a separate closing tag. They are self-contained and close themselves within the tag. Examples of self-closing tags include:
<img>: Used to embed images.<br>: Inserts a line break.<input>: Creates an input field.
Here’s an example of self-closing tags in HTML:
<img src="example.jpg" alt="Example Image" />
<br />
<input type="text" placeholder="Enter your name" />
In this example, each tag does not have a corresponding closing tag and is self-contained.
