HTML - Basic Tags




HTML Basic Tags

HTML is the code that is used to structure a web page and its content. The content could be structured within a set of paragraphs, a list of bulleted points, or using images and data tables.

There are very less thing in HTML which needs to be keep in mind, very few rules are there.

  • In HTML everything is tag, we have to understand basic about all tags and then it’s depends on us how we will use those tags.

  • While creating a HTML document we have to take care about <html>, <head> and <body> tags, where they will be open and where they will be close.

We have a basic framework, ready for content. In this section we'll introduce some basic tags which will be useful for creating content.

HTML tags contain three main parts − opening tag, content and closing tag. But some HTML tags are unclosed tags.

Following are the major HTML tags required to write an HTML −

Doctype html

The <!DOCTYPE html> tag act as links to a set of rules that the HTML page had to follow to be considered good HTML, which could mean automatic error checking and other useful things.

Basically, you can say that it is used for informing web-browser, the HTML document is written in which version of HTML, so that web browser can understand the version of document and render it according to that version rule.

HTML Tag

The <html> element wraps all the content on the entire page, and is sometimes known as the root element.

Head Tag

The HEAD tag start with <head> and end with </head> tag. The <head> element acts like a container for all the stuff. This includes things like keywords & description a page with <meta> tags that you want to appear in search results, CSS to style our content with <link> tags, character set declarations.

Title Tag

The <title> element the sets the title of your page, which is the title that appears in the browser tab the page is loaded in. It is also used to describe the page when you bookmark / favourite it.

Body Tag

The <body> element contains all the content that you want to show to web users when they visit your page, like - text, heading, paragraph, images, videos, games, playable audio tracks etc.

Heading Tag

Most of the write normally start with a heading i.e. ‘head;’ depending upon the write up, heading could be <H1>, <H2>, <H3>, etc.

Example

<!DOCTYPE html>
<html>
 <head> If it is title then
 <title>This is a title</title>
 </head>
 <body>
  <h1>This is heading 1</h1>
  <h2>This is heading 2</h2>
  <h3>This is heading 3</h3>
 </body>
</html>

Result

If it is title then This is a title

This is heading 1

This is heading 2

This is heading 3

Further, if you want to make it italic, bold, or underline then

Example

<b>Bold Tag</b>
<i>Italic Tag</i>
<u>Underline Tag</u>

Result

Bold Tag
Italic Tag
Underline Tag

Paragraph Tag

Paragraph tag structures the text into different paragraphs as −

Example

<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<p>Paragraph 4</p>
<p>Paragraph 5</p> and so on…

Line Break Tag

The <br /> tag gives break or space between the characters “br” and the forward slash. However, "br" is an empty element.

Horizontal Lines

It is used to break up the sections, as required to arrange the sentence. The <hr> creates a line and breaks the line proportionally.