A tag is a keyword enclosed in angle brackets < > that tells the browser how to display the content.
Opening tag →
<tag name>Closing tag →
</tag name>
Example
<p>This is a paragraph.</p>
Types of HTML Tags
1.Paired Tags (Container Tags)
2.Unpaired Tags (Empty / Self-Closing Tags)
- Paired Tags (Container Tags)
These tags always come in pairs — an opening tag and a closing tag.
Syntax:
<tagname>Content</tagname>
Example:
<h1>Welcome to HTML</h1>
<p>This is a paragraph.</p>
-
Unpaired Tags (Empty / Self-Closing Tags)
- These tags do not need a closing tag.
- They are used to insert elements that don’t wrap around any content.
Syntax:
<tagname />
Example:
<br> <!-- Line Break -->
<hr> <!-- Horizontal Line -->
<img src="image.jpg" alt="My Image"> <!-- Image Tag -->
Top comments (0)