HTML Singleton Tags With No Closing Tag

A 'void' element doesn't require a closing tag

HTML code

Don Bayley / Getty Images

For most HTML elements, you begin with an opening tag and end with a closing tag. Between those two tags, the content of the element appears. For example:

<p>This is the text content.</p>

The simple paragraph element shows how an opening and a closing tag is used. Most HTML elements follow this same pattern, but several HTML tags do not include both an opening and a closing tag.

What Is a Void Element?

The void elements or singleton tags in HTML don't require a closing tag to be valid. These elements are usually ones that either stand alone on the page ​or where the end of their contents is obvious from the context of the page itself.

The List of HTML Void Elements

Several HTML 5 tags are void elements. When you write valid HTML, you should leave off the trailing slash for these tags as shown below. The trailing slash is required, however, for valid XHTML.

  • <area>: Used for the area inside of an image map.
  • <base>: The base URL for all relative URLs in a document. There can be no more than one of these per document and it must be in the head of the page.
  • <br>: A line break, often used in text content to create a single line break instead of a paragraph. It should not be used to create visual separation on a page by stacking up many <br> tags, because that function is a visual need and therefore the domain of CSS instead of HTML.
  • <col>: Specifies column properties for each column within a <colgroup> element.
  • <command>: Specifies a command that a visitor can invoke.
  • <embed>: Used with external applications and interactive content for integration.
  • <hr>: A horizontal rule, which is a straight line on a page. In many cases, CSS borders create separator lines instead of this HTML element.
  • <img>: One of the workhorse elements of HTML, this is the image tag. It is used to add graphic images to a webpage.
  • <input>: A form element that is used to capture information from visitors. There are a number of valid input types, from the common "text" input that has been used in forms for years, to some new input types that are part of HTML5.
  • <keygen>: This tag creates a key-pair generator field that is used for forms.
  • <link>: Not to be confused with the "hyperlink" or anchor (<a>) tag, this link is to set linkage between a document and an external resource. Use it to link to an external CSS file, for example.
  • <meta>: Meta tags are "information about content." They are found in the head of a document and used to convey page information to the browser. There are many different meta tags that you can use on a webpage.
  • <param>: Used to define parameters for plugins.
  • <source>: This tag allows you to specify alternative file paths for media on your page, including videos or images or audio files.
  • <track>: This tag sets a track to be used with a media file, a video, or audio, which are often added with the <video> or <audio> tags.
  • <wbr>: This stands for Word Break Opportunity. It specifies where in a block of text it would be acceptable to add a line break.
Format
mla apa chicago
Your Citation
Kyrnin, Jennifer. "HTML Singleton Tags With No Closing Tag." ThoughtCo, Jul. 31, 2021, thoughtco.com/html-singleton-tags-3468620. Kyrnin, Jennifer. (2021, July 31). HTML Singleton Tags With No Closing Tag. Retrieved from https://www.thoughtco.com/html-singleton-tags-3468620 Kyrnin, Jennifer. "HTML Singleton Tags With No Closing Tag." ThoughtCo. https://www.thoughtco.com/html-singleton-tags-3468620 (accessed April 19, 2024).