What is an HTML tags

HTML tags are the markups or identifiers for starting and ending of an HTML Element. These tags define how those HTML elements will be displayed and formatted by the browser. In this article, we will see some of the main HTML tags with their explanation. The HTML tags are enclosed with < and > these identifier.

For every HTML tag, there is an opening and closing tag like

<html>( starting tag) and </html>(closing tag).

one HTML tag can contain other HTML tags.

<html> <head>This is head section</head><body>This is body text</body></html>

There are three main parts of any HTML document they are head, body, and footer, you can compare them with our body parts. like the head tag is the utmost part of the HTML document, then comes the body part then the footer. So let’s learn these tags by these types.

Head section – Basic HTML tags

The title tag <title> </title>

The title tag is used for defining the title of the document, and it would be displayed in the title bar of the Browser.

The style tag <style>…</style>

in the style tag, you can add the styles for different HTML elements. There are three different ways to style the document. ie the types of CSS.

  • Inline CSS : define the style inside the HTML Element

<p style=””> This is inline styled text</p>

  • Internal/ Embedded CSS : define the style in the head section of the Document

<style type=”text/css”>Here goes the document style</style>

  • External CSS : Define the style in the external file and add its reference in the head section.

You can also define its type like:

<style type=”text/css”>Here goes the document style</style>

You can also embed the external style sheet by giving its source to the style tag

<style type=”text/css” src=”path_to_some_external_stylesheet.css”></style>

Learn More about how to style HTML document using CSS

The script tag <script>…</script>

Script tags would contain the scripts to manipulate the document in the desired way. This may contain the javascript code or VBscript or may be of any other type of script. One thing here is important to declare the type of script it contains. So if its javascript then we can write the tag like below

<script type=”text/javascript”>Here goes javascript code </script>

You can also write the script in a different file and then embed the script in the HTML document. like

<script type=”text/javascript” src=”path_to_some_external_js_file.js”></script>

Meta tag <meta>…</meta>

The use of meta tags is for the search engine or browser to identify the document details. This defines the metadata of the document. This data is not displayed in the browser but is parsed by the machine, and is used for internal purposes by the browser and search engines. You can use this tag to define information about what this document contains

charset meta: This meta tag is used to define the character set for the HTML document.

<meta charset=”UTF-8″>

description meta: defines the description of the HTML document

<meta name=”description” content=”Learn about various tags used in THTML document. HTML, Head, body, p, div, a, form, meta, style, and script, etc. tags”>

keywords meta: defines the keywords for search engines to identify what this document is about:

<meta name=”keywords” content=”Learn, Basic HTML tags, Learn HTML tags with explanation”>

author meta: defines the author or the document

<meta name=”author” content=”Sunil D”>

viewport meta: The browser uses this meta tag to display the document well on all the devices like mobile, and tablets with various resolutions.

<meta name=”viewport” content=”width=device-width, initial-scale=1.0″>

Body section – Basic HTML tags ( elements )

Below is a list of important and widely used HTML elements. All of them should be used inside the body element of the document which means inside the <body><body> tag.

div tag (Division tag) <div>…</div> – most widely used HTML tag

This is one of the most widely used HTML tags. You can define as many divisions as needed inside HTML documents. put the tag <div><div> inside the body element.

<body><div>…</div><div>…</div></body>

p tag (Paragraph tag) <p>…</p>- One of the most used HTML tags

a tag (Anchor tag) <a>…</a> – One of the most important HTML tags

The anchor tag is used for linking the pages to one another. If you want to link another page inside the document add the anchor tag like:

<a href=”path_to_another_document.html” >This is text will have link</a>

img tag (Image tag) <img>…</img>

Use img tag to display the image. add the src attribute to img tag for showing the image. You can show any type of image like PNG, JPEG, or gif. put the proper extension of the image file.

<img src=”path_to_image.png“></img>

table tag <table><tr><td>…</td></tr><table>

<table>…</table>

<thead>…</thead>

<tbody>…</tbody>

<tr>…</tr>

<td>…</td>

HTML Tags used for styling

<u>…</u> : Use to make the text underlined

<i>…</i> : makes the text italic

<strong>…</strong> : This tag Makes the text bold

Leave a Reply

Your email address will not be published.