Empty Tag in HTML

An HTML element that doesn't need any content or text between an opening and closing tag is called an "empty tag" in HTML. In this condition, a single self-closing tag is used to symbolize it. In other terms, empty tags are tags that have no closing tags. Only the opening tag is present in empty tags. It is utilized to embed particular sorts of material or to offer structural aspects in a web page.

In HTML, typical instances of empty tags include:

  • <img>: Used for web page image embedding.
<img src="image.jpg" alt="Description of the image">
  • <br>: Line breaks in text are created with the <br> element. It is helpful when a big statement has to be broken up for clear visibility while writing an address, novel, blog, etc.

This is some text.<br>This is text on a new line.

  • <input>: In online applications and forms, an "empty element" named "<input>" functions as a tool that enables you to create items that users may click on or fill out. It allows you to ask consumers for their name, address, or phone number. Depending on your need, you may select from various input options, including text boxes, checkboxes, and radio buttons. You utilize many options (attributes) inside the "<input>" tool to make it function.

<input type="text" name="username" placeholder="Enter your username">

  • <hr>: It is used to make divisions or horizontal lines. The <hr> element denotes a thematic break between paragraph-level elements.
<p>This is some content</p>

<hr>

<p>This is more content</p>
  • "<link>: It is utilized to connect outside resources. To create a link between the current piece of text and an outside source, use the HTML element "link". Connecting an external stylesheet, javascript file, etc., is one example of utilizing it.
<link rel="stylesheet" href="styles.css">
  • <meta>: It is used to supply HTML document details, like character encoding or viewport settings.
<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
  • <source>: An empty element named "source" enables several media resources for the "image," "audio," or "video" components. Various browsers accept different image and media file formats, so it offers the same media content in several alternative file formats to ensure interoperability with a wide range of browsers.
  • <track>: "The text tracks for audio and video media components are specified using the <track> element. This section provides text-containing files that should be seen when the video is playing, such as subtitles, caption files, etc. You can specify timed text tracks (or time-based data) using this feature, for instance, to handle subtitles automatically. The tracks belong to the Web Video Text Tracks (.vtt files) format.
  • wbr>: The HTML <wbr> element, which stands for word break opportunity, specifies the location inside the text that the browser will consider a line break. Most often, it is utilized when the term being used is very lengthy, and there is a danger that the browser could incorrectly break lines to accommodate the text.
  • "area": It maps a picture section so the user may click on it. Whenever the user clicks on the image's mapped areas, it points them toward other links. It functions as the <map> tag's child tag.
  • <base>: The base URL is given to be used with the <base> element for all relative URLs in a page. A document may only have one <base> element.
  • "col": Each column within a "colgroup" tag has its column characteristics specified using the HTML "col" tag. Each column's style property is configured with this tag. There are no closing tags in this tag.
  • "embed": An HTML page can contain external programs, often multimedia material like audio or video, using the "embed" tag. It serves as a container for plug-ins like embedded flash animations.

Lastly, Since there is no material between these tags, they are self-contained and do not need a closing tag. They have specialized functions like organizing a web page, integrating other resources, or giving the browser and search engines information.