Friday, October 12, 2018

Attributes of HTML tags

Attributes in HTML:-

Attributes is an additional information of a HTML tags or HTML elements. By the tags of HTML we can only write text but by the attributes we can do formatting on HTML contents.We can change color, style and different type of formatting to a HTML contents.  

* Attribute always comes in name and value pair.
* It always written with starting tag.
* It provides additional information to a HTML tag that means each and every tags may contains there own different attributes.

Attributes of BODY tag:-

Body tags also contains different-different attributes which have different meanings. Following are some examples of BODY tag.

Background Attribute:-

Background attribute is of body tag which is used to set the background image. It the inserted image is smaller in size, it automatically gets replicated down and across to fill the entire web page. Example of background attribute of body tag

Syntax: <body background="path of your image\image name.extension of the image">

<html>

<head>

<title>Title of the web page is written here</title>

</head>

<body background="c:\image\pic.jpg">

</body>


       BGCOLOR Attribute of BODY tag:-

This attribute of body tag is used to set the background color of the web page. The value of this attribute can be specified in the form of color name or in the form hexadecimal form. 

Syntax:-      <body bgcolor="blue"> 

Text Attribute of BODY tag:-

This attribute of body tag is used to set the color of the body text. Value of this attribute can be in the form color name or in the form of hexadecimal form.

Syntax:- <body text="red">

Link Attribute of BODY tag:-

 This attribute of body tag is used to set the color unvisited hyperlink. By default the color of the hyperlink is blue. we can change it  to our choice. we can use link value as color name or hexadecimal form.

Syntax:-  <body link="red">

Vlink Attribute of BODY tag:-

Vlink stands for visited link. This attribute of body tag is used to change the color of visited hyperlink from default. By default the color of vlink attribute is purple. we can use the value of vlink attribute in form color name or in the hexadecimal form.

When you close the the website/wepage that has been opened using hyperlink and go to page  from where you opened it, you will found that its color has been changed to purple. This is happened due to the property of Vlink.

Syntax:- <body vlink="green">

Alink Attribute of BODY tag:-

Alink is stands for active link. This attribute is used to change the color of active link from default. By default the color of active link is red. We can use the value of alink attribute in the form color name or in the form of hexadecimal form.

When we click on a link and when the website/webpage is open in another tab if you go and see the link which you clicked, it will be red in color. This means the you opened webpage/website which are in the active mode.

 <html>
<head>
<title>Title of the web page is written here</title>
</head>
<body bgcolor="yellow" link="red" alink="black" vlink="#000000">
<a href="http://www.facebook.com">Facebook</a>
</body>
</html>

TOPMARGIN attribute of HTML tag:-

This attribute of BODY tag is used the set margin of the text from top of the web page. 

Syntax:-  <body topmargin="5px">

LEFTMARGIN attribute of HTML tag:-

This attribute of BODY tag is used the set margin of the text from left of the web page. 

Syntax:-  <body leftmargin="5px">

RIGHTMARGIN attribute of HTML tag:-

This attribute of BODY tag is used the set margin of the text from right of the web page. 

Syntax:-  <body rightmargin="5px">




                                                                                                                                                                                                                                                                                                                                         




Font and Basefont tag of html in a very easy way.

Difference between font and basefont tag in html:- Font tag is a container tag. Basefont tag is empty tag. We can apply font tag in a ...