What is empty tag in HTML
This article is about what is an empty tag in HTML and lists some examples of empty tags. HTML tags are used to define various elements within a webpage, including the empty tag.
What are empty tags?
- Tags that do not require a closing tag are called Empty tags. It is also called unpaired tags.
- An Empty tag has only an ON tag, and a container tag has both an ON and OFF tag but an empty tag has only an ON tag.
- Also, an empty tag contains attributes, but some tags have no attributes. Eg:<br>, <hr>.
- Empty tags are used for a variety of purposes. For example, they are commonly used to insert images, line breaks, and other elements that do not require content.
Example of an Empty tag
- <DOCTYPE> -the first line of HTML document
- <br> – line break tag
- <hr> – Horizontal rule tag
- <img> – Image tag.
- <input> – Input tag
- <link>– Link tag
- <meta>– Meta tag
The above tags do not have end or closing tags, so those tags are empty tags.
Empty tags can also be used with other tags to create more complex elements. For example, the <meta> tag is commonly used to define metadata for a webpage, such as the title and description. The tag itself is not an empty tag, but it is often paired with an empty tag to define specific attributes.
You should first check if the end tag is present, if not, it is an empty tag.
Empty tags are an essential part of HTML and are used to insert various elements onto a webpage that do not require any content. They are easy to use and can help make web pages more functional and visually appealing.