Slide 1
Slide 2
Slide 3

Empty Void elements in HTML5 (HTML-V12)

No Comments

3. Special Case: Empty (Void) Elements

HTML void elements are elements that do not need a closing tag. These tags have no content model, and they also do not allow other elements to be placed inside them (nesting). Void elements are also known as empty elements or self-closing elements.

Some void elements include:

No. Element Description
1 <img> Used to insert images into HTML documents.
2 <hr> It displays a horizontal line.
3 <br> It is used to insert a line break.
4 <source> It is used for embedding media resources such as audio and video.

Note: You may see these tags written with a slash / at the end, such as <br />. This is an older writing style and is not necessary in modern HTML5.

Source Code:

Copied!
<!DOCTYPE html>
<html>
<head>
    <title>Void Elements Example</title>
</head>
<body>

    <h2>HTML5 Void Elements Example</h2>

    <p>
        This is an image displayed using the img tag:<br>
        <!-- img tag -->
        <img src="Kru_IT.png" alt="Sample Image">
    </p>

    <!-- hr tag -->
    <hr>

    <p>
        This is an example of line break using br tag.<br>
        Line one<br>
        Line two<br>
        Line three
    </p>

    <!-- video with source tag -->
    <h3>Video Example</h3>
    <video width="320" height="240" controls>
        <source src="NewCover.mp4" type="video/mp4">
        Your browser does not support the video tag.
    </video>

</body>
</html>

Result:


Watch the video:


Ebook: https://softkhpc.blogspot.com/2026/11/html-tutorial-beginners.html

back to top