Sunteți pe pagina 1din 15

HTML TAGS, THEIR MEANINGS AND USAGE WITH EXAMPLES

1. <HTML> Tag: <HTML> tag is used at the beginning of every HTML (Hyper Text Markup Language) page. When browser executes this tag, it knows that it is the beginning of a HTML page. This tag is used as follows: Example: <HTML> </HTML>

2. <HEAD> Tag: <HEAD></HEAD> Container for elements describing the current document. This section contains no contents the browser should display in the body of the text. The following elements are allowed inside the HEAD section : BASE BASEFONT BGSOUND ISINDEX LINK META SCRIPT STYLE TITLE Example: <HTML> <HEAD> </HEAD> </HTML>

Page 1

3. <TITLE> Tag: <TITLE></TITLE>Specify the title of the HTML document. This element is only allowed inside the HEAD element. It assigns a title to the page. Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> </HTML>

Output for <HTML><HEAD><TITLE> Tag:

Page 2

4. <BODY>Tag: This element contains the body of the website document. If a <HEAD> section is present in the page then the body must be placed after this section. All the elements which are to be presented on the body of the web page are declared in this section. Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY> It contains main body of web page </BODY> </HTML>

Output for <BODY> tag:

Page 3

5. <BODY bgcolor = color> Tag: bgcolor is a sub tag of the body tag and is used to set a background color in the body of a HTML document. The usage of this tag can be seen as under: Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY bgcolor = "Green"> It contains main body of web page </BODY> </HTML>

Output for the <BODY bgcolor = color> Tag:

Page 4

6. <BODY text = color> Tag: This tag is also a sub tag which is paired with the <BODY> tag and is used to change the text color of the body. This can be explained as under: Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY text="Red"> It contains main body of web page </BODY> </HTML>

Output for <BODY text = color> Tag:

Page 5

7. <FONT FACE = font name> Tag: This tag is used in pairing with the <FONT> tag to change the font styling of the HTML page. This tag is used within the body region of the HTML document. This can be shown as under: Example: <HTML> <HEAD> <TITLE> This is the title </TITLE> </HEAD> <BODY> <Font face="forte"> Body section begins in here </font> </BODY> </HTML>

8. <FONT color = color> Tag: This tag is a sub tag and is used in pairing with the <FONT> tag to change the font color of the text. Font color can be used in pairing with the Font tag anywhere in the body region of the HTML document. This is explained under: Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <Font color="blue"> It contains main body of web page </BODY> </HTML>

Page 6

9. <FONT size = number> Tag: This tag is a sub tag and is used in pairing with the <FONT> tag to change the font size of the text. Font size can be used in pairing with the Font tag anywhere in the body region of the HTML document. This is explained under: Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <Font size="26"> It contains main body of web page </BODY> </HTML>

Output for <FONT face = font name> <FONT size = number> <FONT color = color name> Tags:

Page 7

10. Heading <Hn (n = 1, 2, 3, 4, 5 & 6)> Tag: The elements H1, H2, H3, H4, H5 and H6 are used to create several levels of headers, with H1 as the most important header and H6 as the least important. They goes on decreasing in size as we move from <H1> to <H6>. This can be explained as under: Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY> <H1>Information Technology</H1> <H2>Management Principles & Practices</H2> <H3>Managerial Economics</H3> <H4>Managerial Accounting</H4> <H5>Business Communication</H5> <H6>Business Environment</H6> </BODY> </HTML> Output for Heading <Hn (n = 1, 2, 3, 4, 5 & 6)> Tag:

Page 8

11. <BR> Tag: <BR> tag is called the Line Break tag. It breaks the current line and continues from the next line the on going elements of the body. Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY> It contains <br>main body</br> of web page </BODY> </HTML> Output for <BR> Tag:

Page 9

12. Paragraph <P> Tag: Paragraph <P> tag is used to begin a new paragraph within the body section of the HTML document. This tag is closed as </P> when the paragraph ends. Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY> <p>First paragraph</p> <p>Second paragraph</p> </BODY> </HTML> Output for the Paragraph <P> Tag:

Page 10

13. <CENTER> Tag: This tag is used within the body section of the HTML document. Text lying within this tag comes in the center of the web page when viewed in a web browser. Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY> <center>HTML</center> </BODY> </HTML> Output for <CENTER> Tag:

Page 11

14. Subscript <SUB> & Superscript<SUP> Tags: <SUB></SUB> this is a container for text that should be displayed as a subscript, and, if practical, using a smaller font (compared with normal text). <SUP></SUP> Display the text as a superscript. These tags can be explained practically as under: Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY> (A+B)<SUP>2</SUP>=A<SUP>2</SUP>+B<SUP>2</SUP>+2AB <BR> H<SUB>2</SUB>SO<SUB>4</SUP> </BR> </BODY> </HTML> Output for <SUB> & Superscript<SUP> Tags:

Page 12

15. Bold <B>, ITALIC<I> & Underline<U> Tags: <U> Tag is used to underline the text which is put in this tag. <I> Tag is used to give the text the Italic bending towards right, which gives the text typed in the italic font effect. <B> Tag is used to make the Text strong or bold. These tags can be explained practically as under: Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY> <B>Web page</B> <I>through</I> <U>html</U> </BODY> </HTML> Output for Bold <B>, ITALIC<I> & Underline<U> Tags:

Page 13

16. Image <img src =image location> Tag: Image <img src = image location> Tag is used to insert images within a HTML document. The usage of this tag can be explained with the following example: Example: <HTML> <HEAD> <TITLE> Web document </TITLE> </HEAD> <BODY> <img src=D:\Wallpapers\Vista\Waterfall.jpg "height="900" width="650"> </BODY> </HTML> Output for Image <img src =image location> Tag:

Page 14

PRACTICAL FILE ON BASIC HTML TAGS

Submitted by, Atinderdeep Singh PGDM- FT, Semester Ist Roll No. 107, Section-B

Page 15

S-ar putea să vă placă și