Learn
🤖 AI Hub 📰 News 📖 Dictionary 🧰 Resources
Grow
💼 Jobs 🚀 Community 🏆 Challenges
Explore by Stage
🌑 Zero 📚 Learn 🔧 Practice 🏗 Build 🚀 Launch 💰 Earn
Account
Login Sign Up
🏗️HTML 🎨CSS ⚡JavaScript 🐙Git & GitHub ⚛️React Soon 📘TypeScript Soon 🐍Python 🗄️Database & SQL Soon 🌐Web Development Soon ☁️Cloud & DevOps Soon 🤖AI & ML Soon 📄Resume Prep Soon 🎤Interview Prep Soon 💼Freelancing Soon 🚀SaaS & Side Projects Soon 🤖Automation Soon
Beginner 🕑 3 min read 👁 7 views 📅 Jun 01, 2026

HTML Tags & Elements — How HTML Actually Works

Learn the difference between tags and elements, how nesting works, void elements, and the core tags every beginner must know.

Tag vs Element

These words are often confused. Here's the clear distinction:

  • A tag is the keyword in angle brackets: <p> or </p>
  • An element is the complete unit: opening tag + content + closing tag
<p>This is a paragraph.</p>
 ^          ^              ^
Opening  Content        Closing tag
 tag

The whole thing = one element

Anatomy of an HTML Tag

<a href="https://google.com" target="_blank">Visit Google</a>
 ^   ^                        ^               ^
tag  attribute name           attribute value  content

Void (Self-Closing) Elements

Some elements have no content and no closing tag:

<img src="logo.png" alt="Company logo">
<br>       <!-- line break -->
<hr>       <!-- horizontal divider -->
<input type="text" placeholder="Search...">
<meta charset="UTF-8">
In HTML5, self-closing slashes like <br /> are optional. <br> works fine.

Nesting — Elements Inside Elements

<div>
  <h2>iPhone 15 Pro</h2>
  <p>A <strong>powerful</strong> phone with a <em>titanium frame</em>.</p>
  <p>Price: <strong>Rs.1,34,900</strong></p>
</div>

Golden rule: always close the innermost tag first.

<!-- WRONG -->
<b><i>text</b></i>

<!-- CORRECT -->
<b><i>text</i></b>

Most Important Tags to Know

TagPurpose
<h1> to <h6>Headings — h1 is biggest
<p>Paragraph of text
<a>Clickable hyperlink
<img>Image
<div>Block-level container
<span>Inline container
<ul> + <li>Bullet list
<strong>Bold / important text
<em>Italic / emphasis

HTML Comments

<!-- This is a comment. Users will not see this. -->
<p>This paragraph IS visible.</p>

Practice

Build a product card using proper nesting:

<div>
  <h2>OnePlus 12</h2>
  <p>Flagship killer with <strong>Snapdragon 8 Gen 3</strong>.</p>
  <p>Price: <strong>Rs.64,999</strong></p>
  <a href="#">Buy Now</a>
</div>

Try making 3 different product cards. This is exactly how e-commerce sites structure product grids.

Was this lesson helpful?

🎯 Finished this lesson?

🔗 Related Tutorials
🤖 Got a Doubt? Ask AI
Get instant answers in Hindi or English
🤖
Z2T Bot
Online
Ask me anything about this tutorial — I'm here! 👋