Html Body Tag Attributes with examples |Free Pdf |HTML TUTORIALS #4

codesparta-html-5-body-tag attributes

When we discussed about the Document structure of the HTML , we also discussed about the body element then , <body> tag represents the Document start we generally put all the visible elements of the Html Page in Body section.

Here is some Html Code

So as you can see we have put all the visible elements , like H1 and paragraph elements inside the body tag . There are some attributes for the body tag , attributes are nothing but some additional properties that we can put inside a tag .

Html Body Tag Attributes with examples

Red Colored Attributes are not supported by HTML 5 and are considered obsolete .

Text : Gives Text inside the body tag the specific color .


Bgcolor : Add Specific Color to the background.


Background : We can any image as the background by giving its URL in the attribute .


Alink : Colors all the a elements present in the body tag .


Vlink : The defualt color for all the elements in the body section.


Link : The default color of the text in all links contained by the element.

Body Element Specific Attributes HTML 5

The following table shows the attributes that are specific to this body  tag/element.

HTML5 introduced the following event handlers that can be used with the <body> element .

onafterprintThe afterprint event handler
onbeforeprintThe beforeprint event handler
onbeforeunloadThe beforeunload event handler
onhashchangeThe hashchange event handler
onmessageThe message event handler
onofflineThe offline event handler
ononlineThe online event handler
onpagehideThe pagehide event handler
onpageshowThe pageshow event handler
onpopstateThe popstate event handler
onstorageThe storage event handler
onunloadThe unload event handler

Read this Article offline also , Download PDF Version by clicking the pdf icon

If you liked our content please Subscribe to our Website for more helpful content.

Leave a Reply

Your email address will not be published. Required fields are marked *