HTML Basics-General HTML Attributes and Attributes used with Body Tag

HTML Basics-General HTML Attributes and Attributes used with Body Tag-HTML Attributes are used to change the properties of the tags. These attributes can be placed only in side the opening or the starting tag. Though some attributes do not require a value associated but generally a value is associated with each attribute. The attribute and value are separated by an equal to sign(=) and the value portion surrounded by quotation marks(Double inverted Commas). 


HTML Basics-General HTML Attributes and Attributes used with Body Tag

If the value portion contains spaces the quotation mark becomes a must. In practice the quotation marks are used always to avoid any chance of mistake. These are written like this - <Tag Name Attribute=“Value”>…text….</Tag Name>


General HTML Attributes

‘Align’ Attribute 

The ‘Align attribute is used to set the alignment of HTML elements. The common value used are  (1) “Centre”(2) “Justify” (3) “Right” (4) “Left”. Please see this example –


<H6 Align = “Left”>Main Heading<H6>


The resultant display –


Main Heading


If we replace  “left” with “centre” the resultant display will change as –

Main Heading

‘Color’ Attribute

The color attribute is used to specify color. To specify a color we can give the color name such as ‘Blue’ or we can use hexadecimal code(The ‘#’ sign followed by 6 digits representing the primary colors ‘Red’, ‘Green’ and ‘Blue’ Popularly known as ‘RGB’) Examples –


               (1)             Using Color name - <Font color=“Blue”> Lucida</Font>

(2)             Using Color Code - <Font color=“#0000ff”> Lucida</Font>

‘Height’ Attribute and ‘Width’ Attribute

The ‘height’ attribute and ‘width’ attributes are used to set the height and width of the element. We can use these attributes in two forms, (1) The absolute form and (2) The relative form. In absolute form we specify the absolute value such as “200”, “300” and in relative form it relates to the container such as ‘50%’, ‘60%’

Example of absolute form - <hr width=“300”>

Example of relative form - <hr width=“60%”>


HTML Attributes used with body Tag

In HTML for the purpose of controlling the document as a whole, <body> has some important attributes such as –


(1)             Link – This attribute is used to specify the color of the link.

(2)             Text – This attribute is used to specify the color of the text on the page.

(3)             Vlink - This attribute is used to specify the color of the link visited earlier.

(4)             Alink - This attribute is used to specify the color of a link active now.

(5)             BGColor – This attribute is used to specify the background color of the document,

(6)             Background – This attribute is used to set an image as back ground  of the page.


The attributes explained above from serial no- 1 to Serial No-5  need color name such as “Blue”, “Red” or “Green” or Hexadecimal codes “#0000FF”, “#FF0000”, or “#008000” as value And the attribute ‘Background’ explained at serial No-6 will need an image URL as value.

You may like to read on -Make your Microsoft Word DocumentPassword Protected and make them safe and secure-


Example -   <body text=“blue” background=“…background image URL…”<body>
                   <body text=“#0000FF” background=“…background image URL…”<body>

When we use the attribute ‘background’ the attribute ‘bgcolor’ is overridden automatically and the background of the page will be formed by the image. In case the image could not be traced for any reason the attribute ‘bgcolor’ will work.


Note – Some html attributes may work with some tags but may not work with others. For example ‘height’ and ‘width’ work good with <Font> but are meaningless if used with <H5>.

w3schools html tags, html tags, basic html structure tags, background color tag in html, what is the use of body> tag in html code, What are the 4 attributes of body HTML, What are the 3 types of attribute in HTML, html tags and attributes list with examples, attributes of body tag in html with example, what are the main elements of an html document, What are the attributes of body tag in HTML, What are the basic tags and attributes in HTML


Special requestPlease let us know through a comment that how our effort was. Do not hesitate to give an dverse opinion, give your opinion impartially. Please subscribe to our blog and like our Facebook page. Subscribe to our YouTube channel “Start with Wikigreen”. Please share it to your friends and beloveds. Thanks a lot for visiting our page.

2 टिप्पणियाँ

Please Donot spam

  1. Knowledgeable about Html............

    I like your blog and I am a follower of your blog now, you are welcome on my blog and if you like it then follow it and give your suggestion

    जवाब देंहटाएं
  2. I always used to read post in news papers but now as I am a user of net so from now I am using net for articles,
    thanks to web.

    Feel free to surf to my web site - phen375 unbiased reviews

    जवाब देंहटाएं
और नया पुराने