HTML void elements

Arjun SharmaArjun Sharma
1 min read

"Imagine you're playing with building blocks, and you have a special block that you can't stack anything on top of. That's like a void element in HTML!

Void elements are special because they don't have anything inside them, like a block that can't hold other blocks on top. They're like the building blocks of your computer storybook, but they don't need anything else inside them to work.

One example of a void element is the <img> tag. It's like a picture block in your storybook. You don't put anything inside the <img> tag because it's already a complete picture by itself!

So, when you want to add a picture to your computer storybook, you use the <img> tag like this:

The <img> tag doesn't need anything else inside it because it's already a complete picture block. It's like having a special building block that stands alone and makes your computer storybook even more fun!"

Other examples of void elements include <input>, <br>, <meta>, <link>, and <hr>. These elements are also self-closing and do not require a closing tag. Each serves a specific purpose in web development, allowing developers to include various types of content or functionality within their web pages efficiently.

0
Subscribe to my newsletter

Read articles from Arjun Sharma directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Arjun Sharma
Arjun Sharma

"Enthusiastic QA Analyst with a profound interest in backend development, driven by a passion for creating robust and reliable software systems. Committed to continuous learning and exploration of backend technologies, I find joy in unraveling complexities and optimizing performance. Beyond the code, I am dedicated to mentoring kids, sharing my knowledge, and igniting their curiosity for technology. Through insightful blog posts, I aim to inspire others while fostering a supportive community of learners. Join me on this journey as we explore the world of backend development and empower the next generation of tech enthusiasts!"