Open In App
Related Articles

Tags vs Elements vs Attributes in HTML

Like Article
Save Article
Report issue

In this article, we will see the difference between Tags vs Elements vs Attributes in HTML with different examples of each of them.


HTML Tags:

HTML Tags are the starting and ending parts of an HTML element. They begin with < symbol and end with > symbol. Whatever is written inside < and > are called tags.


In this example <b> is the starting tag and </b> is the ending tag.


<b> </b>


HTML elements:

The HTML element consists of both the opening and closing tags as well as what’s inside those tags. It normally consists of some structure that’s used to define the respective tags.


In this example <b> is the starting tag and </b> is the ending tag but with content inside it.


<b>This is the content.</b>

This is the content.

HTML Attributes:

HTML Attributes is used to define the character of an HTML element. It always placed in the opening tag of an element. It generally provides additional styling (attribute) to the element.


In this example <p> is the starting tag and </p> is the ending tag with extra css attributes.


<p align="center">This is paragraph.</p>

This is paragraph.

Tags vs Elements vs Attributes difference

HTML TagsHTML ElementsHTML Attributes
HTML tags are used to hold the HTML element.HTML element holds the content.HTML attributes are used to describe the characteristic of an HTML element in detail.
HTML tag starts with < and ends with >Whatever written within a HTML tag are HTML elements.HTML attributes are found only in the starting tag.
HTML tags are almost like keywords where every single tag has unique meaning.HTML elements specifies the general content.HTML attributes specify various additional properties to the existing HTML element.

Tags define the type of HTML element (e.g., heading, paragraph).

Elements represent the complete, functional unit on a webpage.

Attributes provide extra information or settings for elements.

Last Updated : 20 Dec, 2023
Like Article
Save Article
Share your thoughts in the comments
Similar Reads
Complete Tutorials