HTML basic tags

This chapter discusses some HTML basic tags, what HTML tags are and what they are used for.

We will also describe in detail the tags that we have briefly mentioned before and some new tags that have not been mentioned yet.


HTML Document Tags Template

See this document it covers some HTML basic tags.

HTML document tags template code

<!DOCTYPE html>
<html>

<head>
<title>HTML template</title>
</head>

<body>

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

</body>
</html>
The result in the browser
This is a heading

This is a paragraph.


Let us understand the HTML basic tags included in the above document with details one by one:

The <!DOCTYPE> Declaration

  • The "Doctype Declaration Tag" represents the document type, and helps the browser display web pages correctly.
  • It should be typed only once at the top of each HTML page (before any HTML basic tags).
  • <!DOCTYPE> declaration is not case sensitive, That is, work can be done without it.

HTML5 Declaration Sample

For html5 the doctype declaration is:

HTML5 declaration code

<!DOCTYPE html>

The <HTML> tag

  • HTML has two tags: the first start tag <HTML> and the second </HTML> end ie last tag.
  • The HTML tag is the first tag of the HTML document after the declaration tag.
  • The tags of the entire HTML document are written within it, ie Meta Tags, Title Tag, Head Tag, Body Tag etc. will all be written within this tag, this tag will start at the beginning of the document and will close after writing the complete document.

HTML tag template

HTML tag template code

<HTML>

...

</HTML>

The <body> Tag

  • "Body Tag" is the second most important tag of HTML, Inside this tag we write our article, The first start tag is <body> and the second </body> end is the last tag.
  • The body tag will start after the head tag and will close after writing the complete document.

body tag template

body tag template code

<body>

...

</body>

The Heading Tags

  • "Heading Tags" are used for headings written for an article. It consists of two tags, the first starting tag <h1> and the second </h1> End means last tag.
  • HTML consists of six types of headings, from h1 to h6.
  • "h1" is used for the most important heading followed by h2 and h6 for the last important heading.

Heading tags template

Heading tags template code

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
The result in the browser
This is heading 1
This is heading 2
This is heading 3
This is heading 4
This is heading 5
This is heading 6


The Paragraph Tags

  • "Paragraph Tags" are used to write an article, it consists of two tags, the first start tag <p> and the second </p> end tag.
  • After completing a paragraph, when you start another paragraph, you will use the paragraph tag again, ie write a new paragraph tag for each new paragraph.

Paragraph tags template

Paragraph tags template code

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
The result in the browser

This is a paragraph.

This is another paragraph.