Loading...
HTML Basic Tags

HTML Basic Tags

In this tutorial, we will learn about the basic tags in HTML with the help of examples.


Basic Tags

HTML consist of a series of tags/elements that we must consider and include while starting to code. These elements/tags tell the browser how to display the content on web-pages.


Basic HTML Document

MY first program :-

<!DOCTYPE html>
<html>
  <head>
    <title>Hello!</title>
  </head>
  <body>
    <h1>This is simple heading.</h1>
    <br>
    <p>This is a simple paragraph.</p>
    <hr>
  </body>
</html>

Explaination of tag used in above example

Tags Description
<!DOCTYPE html> Every HTML document start with a HTML document tag. It informs the web browsers about the type and version of HTML used in the document. It is not mandatory but it is good practice to start with this tag. It is not case-insensitive.
<html> Every HTML document must be enclosed between basic HTML tags.it start with <html> tag and ends with </html> tag.
<head> the head tag comes after the tag and contains all the headings of the document/webpage.it also contain title, metadata, links and so on.it start with <head> tag and ends with </head> tag.
<title> This tag represents the title of the page which will be displayed on the tab/windows bar of the browser.this tag contains the header information and mentioned within the <head> tag. It start with <title> tag and ends with </title> tag.
<body> This is the most important of all tags. Every content written within this tag will be displayed on the webpage and contains all the visible or audible content.(like tables, paragraphs, links, images,lists, etc.) this tag starts with <body> and ends with </body> tag.
<h1> This tag defines the large heading. This tag start with <h1> and ends with </h1>.
<br> This tag defines the break. this tag start with <br> and ends with </br>.
<p> This tag defines the paragraph. This tag start with <p> and ends with </p>.
<hr> This tag defines the horizontal line.this tag start with <hr> and ends with </hr>.

Headings

There are six levels of headings are defined in HTML (<h1> to <h6> ).

<h1>It is the most important/Largest heading.</h1>
<h6>It is the least important/smallest heading.</h6>

Output

It is the most important/Largest heading.


It is the least important/smallest heading.

Paragraphs

The <p> tag help us to write paragraphs in a webpage.

<p>This is first paragraph.</p>
<p>This is last paragraph.</p>

Output

This is first paragraph.

This is last paragraph.


Horizontal Line

The <hr> tag used to display horizontal line in a webpage. this tag does not have any closing tag.

<p>This is first paragraph.</p>
<hr>
<p>This is last paragraph.</p>

Output

This is first paragraph.


This is last paragraph.


Types of Tag in HTML

Tags Description
Paired Tags Tags that have both opening and closing tags are known as paired tags. (like - <p>...</p>, <head>...</head> etc.)
Singular/Void Tags Tags that don't have a closing tag or any contents. These tags are known as void tags. Void tags include <img> tag, <meta> tag, <link> tag, and <input> tag, <hr> tag.

Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of basic tags in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML elements.

- Related Topics