What is Tag?

In HTML, a tag is a fundamental component used to define elements within a document.

Tags are keywords enclosed in angle brackets (< and >) that indicate the beginning and end of an HTML element.

The basic syntax of an HTML tag looks like this:

Syntax 1: Singular Tag

<tagname>

Syntax 2: Paired Tag

<tagname>content</tagname>


Examples of Syntax 1

<img> tag -- To display an image
<hr> tag -- To display the horizontal line
<br> tag -- To display a line break

Examples of Syntax 2

<p></p> tag -- To display a paragraph
<video></video> tag -- To display a video


Tags can be of two types

1. Paired Tag
2. Singular Tag

When a tag has opening and closing both parts, it is known as paired tag. For example

<html></html>, <head></head>, <title></title>, <body></body>, <p></p>, <video></video>, <table></table> etc.

When a tag has only opening part, it is known as singular tag. For example

<img>, <meta>, <hr>, <br> etc.

Comments

Popular posts from this blog

What is suggested learning path for learning full stack development?

What is Full Stack Development?

Define few tags with their usage?