What is replaced, non-replaced and void elements in HTML
9/14/2025
Element Type | Closing Tag Required? | Can Contain Content? | Common Examples |
Non-Replaced | Yes | Yes | <p>, <div>, <h1> |
Replaced + Void | No | No | <img>, <input>, <br> |
Replaced + Non-Void | Yes | Yes | <video>, <iframe>, <object> |
Void + Non-Replaced | No | No | <meta>, <link>, <base> |
If you're preparing for a web development interview or just starting with HTML, understanding the different types of HTML elements is a must. Three terms often cause confusion: replaced elements, non-replaced elements, and void elements. Here’s a clear guide to help you grasp these concepts quickly and confidently.
Non-replaced elements are your standard HTML tags. They come with an opening tag and a closing tag, enclosing the content you want to display on the web page.
Replaced elements are a bit different. Instead of your usual text or nested tags, these elements get replaced by external objects or controls when the page loads.
Void elements are self-closing tags. This means they don’t have a closing tag and cannot contain any content inside them.
Sometimes, you’ll see them written with a slash at the end.
<br/>
<!-- <div> is a container -->
<div>
<!-- <h1> is a main heading -->
<h1>Welcome to My Website</h1>
<!-- <p> is a paragraph -->
<p>
This is my first website. I want to <strong>learn HTML</strong>
and become better at web development.
</p>
</div>
<!-- <img> shows an image -->
<img src="https://via.placeholder.com/150" alt="Sample Image" />
<!-- <input> creates a field where user can type -->
<p>
Enter your name:
<input type="text" placeholder="Your name here" />
</p>
<!-- <video> plays a video -->
<video width="320" height="240" controls>
<source src="sample-video.mp4" type="video/mp4" />
Your browser does not support the video tag.
</video>
<!DOCTYPE html>
<html lang="en">
<head>
<!-- <meta> gives metadata about the page -->
<meta charset="UTF-8">
<meta name="description" content="Example of HTML tags br, hr, img, input, meta">
<title>HTML Example</title>
</head>
<body>
<!-- <img> shows an image -->
<img src="https://via.placeholder.com/150" alt="Sample Image" />
<!-- <br> inserts a line break -->
<p>Hello,<br>this text is on the next line.</p>
<!-- <hr> creates a horizontal line (divider) -->
<hr>
<!-- <input> creates a text box -->
<p>
Enter your email:
<input type="email" placeholder="example@mail.com" />
</p>
</body>
</html>