Breaking News

Basic HTML Tags

The most important tags in HTML are tags that define headings, paragraphs, body and line breaks. The basic HTML Tags are described here in the form of table so that you can remind them easily.
Basic HTML Tags
Tag Description
<html> Defines an HTML document
<head> Defines information about the document
<title> Defines the document title
<body> Defines the document’s body
<h1> to <h6> Defines header 1 to header 6
<p> Defines a paragraph
<br> Inserts a single line break
<hr> Defines a horizontal rule
<!–> Defines a comment
Description Of The Above Tags
This element tells a browser that this is an HTML document. This tag is defined at the top of the HTML file and at the end of file.
<html> <body>…………..body of HTML………….</body></html>
<html> <body> this is my first page </body></html>
<head> tag
The head tag defines information about the document. The browser does not display the “head information” to the user. The following tags can be in the head section: <base>, <link>, <meta>, <script>, <style>, and <title>. The head tag is used between <html> and <body> tags.
<html> <head>…..head sections….</head><body>……body of HTML……..</body></html>
<html> <head><title>Basic tag</title></head>>body> this is my first page </body></html>
<title> tag
Title tag defines the title of the document which appears in the Title bar of the explorer window. Title tag is used in between <head> and </head> tag because it is title tag is section of <head> tag.
<html> <head><title>Title of the Page</title></head><body>…..body of HTML……</body></html>
<html> <head><title>Basic tag</title></head><body> this is my first page </body></html>
<body> tag
The body element defines the document’s body. It contains all the contents of the document (like text, images, colors, graphics etc).
<body bgcolor =”color_name” background=”file_name” links=”color_name” text=”color_name”>
<body bgcolor =”red” background=”c:\img\sky.jpg” links=”blue” text=”black”>
Attribute Value Description
background file_name An image to use as the background. Deprecated. Use styles instead.
bgcolor color_name The background color of the document. Deprecated. Use styles instead.
link, alink, vlink color_name Specifies the color of all the links in the document. Deprecated. Use styles instead.
text color_name Specifies the color of the text in the document. Deprecated. Use styles instead.
<hn>…</hn> Heading Tags
These tags are used to display headings in an HTML document. through these tags you can increase the size of the text. In these tags <h1> tag defines the largest header & <h6> defines smallest.
These tags are <h1> </h1>, <h2> </h2>, <h3> </h3>, <h4> </h4>, <h5> </h5>
<hn>………….. text…………..</hn>
<h1> this is my first page </h1> or <h1 align=”right”>text</h1> Attribute of the <hn> Tag.
Attribute of the <hn> Tag
It has only one attribute i.e. Align=”value” values may be right, left, center and justified. you can use this align attribute in many tags to align the text or elements.
align value (right, center, left, justified)
<p>…..</p> Paragraph Tag
This tag is used for creating the paragraph in the web page. It is used inside the body of file.
<p> This is the test of paragraph tag……..</p>
In this tag align attribute can be used.
<br> tag
The <br> tag inserts a single line break. Use the <br> tag to enter blank lines, not to separate paragraphs. This tag has no end tag.
text……..<br> …..text
This is a break <br> in the line.
<hr> tag
The <hr> tag inserts a horizontal rule. The <hr> tag has no end tag.
text……<hr> ……text or text……<hr align=” ” size=” ” width=” “>…. text
This is the test of the tag <hr>
Attribute Value Description
align right,left,center The alignment of the horizontal rule.
size % , pixels The thickness (height) of the horizontal rule.
width % , pixels The width of the horizontal rule.
<!–…–> Comment Tag
The comment tag is used to insert a comment in the source code. A comment will be ignored by the browser. You can use comments to explain your code, which can help you when you edit the source code at a later date.
You can also store program-specific information inside comments. In this case they will not be visible for the user, but they are still available to the program. A good practice is to comment the text inside the script and style elements to prevent older browsers, that do not support scripting or styles, from showing it as plain text.
<!– add here your comments these will not be displayed –>
<!– add here your comments these will not be displayed –>
You might have became bored of reading so lets do some practical.
Follow these Steps:
copy this code in the new file of any text editor.
Save it with htm or html extension.
Open the Internet Browser.
Open the saved file in it.
<title>In body tag</title>
<body bgcolor=”lightyellow” text=”red”>
In body tag, background color is defined as black and textcolor is defined as the white.
<h1> this is the h1 header </h1>
<h2> this is the h2header </h2>
<h3> this is the h3 header </h3>
<h4> this is the h4 header </h4>
<h5> this is the h5 header </h5>
<hr>This is the use of “Break” tag<br> and you will see use of more tags<br>
<hr> look at the use of comment tag it is<!– It is a comment line –> good
<hr><p> This is the use of paragraph tag and you will see use of more tags </p>
The effect of “hr” tag <br> <hr>
Explanation of the page:
The title of the page is at the top in blue strip. All the text appears in white color and background in the black color. Because in the <body> tag the bgcolor and text color is defined. The horizontal line appears because of the <hr> tag and the <br> tag breaks the text in between and displays it on new line. The comment statement is not displayed.

Check Also


Attributes   Tags Attribute Value Description <table> align left,center,right Aligns the table. Deprecated. Use styles …