Skip to main content

What are paired and void tags?

In HTML, all tags are divided into paired and void (non-paired) ones, based on whether they contain inner content and require a closing tag.


1. Paired tags

These are tags that have an opening and a closing part. Between them is the content: text or other elements.

Example:

html
<p>This is a paragraph of text.</p>
  • <p> is the opening tag,
  • </p> is the closing tag (with a slash /),
  • This is a paragraph of text. is the content.

Paired tags: <div>, <span>, <a>, <p>, <h1>-<h6>, <ul>, <li>, <table>, <section>, <article>, <header>, <footer> and most others.

They create the structure and nesting of the page.


2. Void (non-paired) tags

These are tags that contain no content and do not require closing. They perform an action on their own: insert an image, a line break, a line, and so on.

Example:

html
<img src="photo.jpg" alt="Photo"> <br> <hr>

Void tags: <img>, <br>, <hr>, <input>, <meta>, <link>, <source>, <area>, <col>, <embed>.

Such tags are considered complete by default: there is nothing inside them, and there cannot be.


3. How the browser processes them

  • For paired tags, the browser creates a container with content.
  • For void tags, it simply performs the action (inserts an image, breaks the line, and so on).

If you close a void tag manually (</img> or </br>), this is considered an error in HTML5.


Summary:

Tag typeFeaturesExample
PairedHas an opening and a closing tag, contains content<p>Text</p>
Void (non-paired)Has no content, requires no closing<img src="photo.jpg">

In simple terms: Paired tags are "boxes with content", while void tags are "self-sufficient commands" that insert something ready-made onto the page.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.

What are paired and void tags?: HTML Interview Question