HTML Tags

HTML Tags are the basic units used to create HTML elements.
They define how content is displayed in a web browser.

In this tutorial, you will learn what HTML tags are, types of tags, and see examples with output.

HTML tags, HTML tag examples, HTML basics, learn HTML tags, HTML syntax

What Are HTML Tags

HTML tags are keywords enclosed in angle brackets used to define elements.

They tell the browser:

  • How to display content
  • What type of content it is

Syntax of HTML Tags

Example

<tagname>Content</tagname>

Explanation

PartDescription
<tagname>Opening tag
</tagname>Closing tag
ContentText inside the tag

Simple HTML Tag Example

Example Code

<h1>This is a heading</h1>
<p>This is a paragraph</p>

Output

This is a heading
This is a paragraph


Types of HTML Tags

HTML tags are mainly divided into two types.

Types of Tags

TypeDescription
Paired TagsHave opening and closing tags
Unpaired TagsDo not have closing tags

Paired Tags (Container Tags)

These tags have both opening and closing parts.

Example

<p>This is a paragraph</p>

Output

This is a paragraph


Unpaired Tags (Empty Tags)

These tags do not have a closing tag.

Example

<br>
<hr>

Explanation

  • <br> creates a line break
  • <hr> creates a horizontal line

Output

Line 1
Line 2



Nested HTML Tags

Tags can be placed inside other tags.

Example Code

<p>This is <b>bold</b> text.</p>

Explanation

  • <b> is inside <p>
  • This is called nesting

Output

This is bold text.


Common HTML Tags

Frequently Used Tags

TagPurpose
<h1> to <h6>Headings
<p>Paragraph
<a>Link
<img>Image
<br>Line break
<hr>Horizontal line

HTML Tags Are Not Case Sensitive

Example

<H1>Hello</H1>
<h1>Hello</h1>

Output

Hello
Hello

Both are correct, but lowercase is recommended.


HTML Tags vs HTML Elements

Comparison Table

FeatureTagElement
DefinitionKeywordComplete structure
Includes ContentNoYes
Example<p><p>Text</p>

Rules for Using HTML Tags

Important Rules

RuleDescription
Proper ClosingClose tags correctly
Correct NestingAvoid overlapping tags
Use LowercaseBest practice
Use QuotesFor attributes

Common Mistakes with HTML Tags

MistakeResult
Missing closing tagBroken layout
Incorrect nestingErrors in display
Typing errorsTag not recognized
Using wrong tagsUnexpected output

HTML Tags Example with Multiple Elements

Example Code

<h1>HTML Tags Example</h1>
<p>This is a <i>simple</i> paragraph.</p>
<hr>

Output

HTML Tags Example
This is a simple paragraph.



Frequently Asked Questions (FAQ)

1. What are HTML tags?

HTML tags are keywords used to define elements.

2. What is a paired tag?

A tag with both opening and closing parts.

3. What is an unpaired tag?

A tag without a closing part.

4. Are HTML tags case-sensitive?

No, but lowercase is recommended.

5. What is the difference between tag and element?

A tag is part of an element, while an element is the complete structure.

Related Article
Introduction to HTML

HTML Introduction – Learn the Basics of HTML HTML is the starting point of web development. Every website you see Read more

What is HTML

What Is HTML – Complete Beginner Explanation HTML is the foundation of the web. Every website you visit, from simple Read more

HTML Basic Examples

HTML Basic Examples – Learn HTML by Practice The best way to learn HTML is by writing and testing simple Read more

HTML text Editors

HTML Text Editors – Learn How to Write HTML Code To write HTML code, you need a text editor. A Read more

HTML Elements

HTML Elements are the building blocks of every web page.Each element defines a part of the webpage, such as headings, Read more

HTML Attributes

HTML Attributes provide additional information about HTML elements.They help control how elements behave, display, or store extra data. In this Read more

HTML Headings

Headings in HTML The <h1> to <h6> tags are used to set up headings in HTML. <h1> shows which heading Read more

HTML Paragraphs

HTML Paragraphs A paragraph is a block of text that always starts on a new line. The HTML <p> element Read more