What are HTML Tags?

Consider this example
<title>Your page title</title>
<!-- An HTML comment which is not displayed on the web page -->
<h1>Your page heading</h1>
<p>Your page content in a paragraph.</p>
The words <html>, <head>, <title>, </title>, </head>, <body>, <h1>, <p>, </p>, </h1>, </body>, </html> etc., are called HTML Tags.
The words <html>, <head>, <title>, <body>, <h1>, <p> etc., are called opening tags / start tags.
The words </html>, </head>, </title>, </body>, </h1>, </p> (with a back slash /) etc., are called closing tags / end tags.

What is the syntax to write an HTML Tag?

HTML Tags are not case sensitive and you are free to use both uppercase or lowercase tags or a combination of both. Now a days many websites use lowercase tags and for future specifications (versions) of HTML it is recommended to use lowercase tags.
Any number of line breaks and spaces in a HTML document are treated as a single space character (exception: <pre></pre> tag).

<p>Your page content in a paragraph.</p>
Your page    content         in a paragraph.
Your page
content in a paragraph.
Your page
   content in a       paragraph.
Your page
   in        a paragraph.
The ouput of all the above codes is same.

List of some commonly used HTML Tags

Please note that the default display of elements will be different from our examples as we use various CSS to style our web page
Tag Description Example
<a>Anchor tag is used to display hyper links This is a link
<b>This tag makes the text inside it bold This is a bold text
<body>This defines the body of a HTML document This tag is found in each and every web page
<br />Introduces a line break in the web page.
It is an empty element which has no closing tag
line 1
line 2
<button>Creates a clickable button (mostly used in forms)
<div>Used to organise content into divisions (sections) Extensively used in almost all web pages
<em>Emphasizes text inside it This text is emphasized
<form>Used to submit data using input tags View forms demo
<frame>Creates a frame which is like a sub-window View frames demo
<h1> to <h6>Heading tags are used to define the heading of a page


in a <h2> tag
<head>Contains the information of a dcoument like page's title View example
<hr />Similar to <br /> tag but introduces a horizontal line line 1

line 2
<html>It is the root of any HTML document It is found in every html document
<i>Makes the text inside it italicized This is an italic text
<iframe>Creates an inline frame View iframes demo
<img />Image tag is an empty tag used to insert images
<input />An empty element used to input data
<label>Acts as a label for an input
<li>Display an item of a list (ordered and unordered)

  • Item 1
  • <ol>Make an ordered list of items
    1. Item 1
    2. Item 2
    <p>Display content in a paragraph This is a paragraph
    This is another paragraph
    <span>Define a section in a document Used to style different sections in an element
    <strong>Make the text look more important This is a strong text
    <table>Create a table You are already viewing this in a table
    <td>Display a table cell This text is in a table cell
    <tr>Create a table row These three cells of the current line form a row
    <ul>Make an unordered list of items
    • Item 1
    • Item 2