SIGN UP MEMBER LOGIN:    
ARTICLE

Body Tag Used to Define Content in Document in HTML5

Posted by Valon Ademi Articles | HTML 5 July 14, 2011
The body tag is used for defining the body content of a document. The body tag must be placed after the end of the head element inside the html element.
Reader Level:
Download Files:
 

This is a main and necessary tag of HTML5, without this tag you can't do anything in your HTML5 document. The body tag must be placed after the end of the head element inside the html element. The body tag is used for defining the body content of a document. The body tag helps render content in a browser. The body tag contains all the contents of an HTML document, such as html comment, button, text, paragraph, lists, image, audio, video, hyperlink etc.

Syntax

<body

alink="color name | #RRGGBB"
background="URL of background image"
bgcolor="color name | #RRGGBB"
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
link="color name | #RRGGBB"
style="style information"
text="color name | #RRGGBB"
title="advisory text"
vlink="color name | #RRGGBB">
</body>

Example

Attributes Introduced by HTML5
accesskey spaced list of accelerator key(s)
contenteditable true | false | inherit
contextmenu id of menu
data-X user-defined data
draggable true | false | auto
hidden hidden
itemid microdata id in URL format
itemprop microdata value
itemref space-separated list of IDs that may contain microdata
itemscope itemscope
itemtype microdata type in URL format
spellcheck true | false
tabindex number

Attributes Defined by Internet Explorer
accesskey "key" (5.5)
bgproperties "fixed" (4)
bottommargin "pixels" (4)
contenteditable "false | true | inherit" (5.5)
disabled "false | true" (5.5)
hidefocus "true | false" (5.5)
language "javascript | jscript | vbs | vbscript" (4)
leftmargin "pixels" (4)
nowrap "false | true" (4)
rightmargin "pixels" (4)
scroll "no | yes" (4)
tabindex "number" (5.5)
topmargin "pixels" (4)
unselectable "off | on" (5.5)

Attributes Defined by Netscape
marginheight "pixels" (4)
marginwidth "pixels" (4)

HTML5 Event Attributes
onabort onafterprint onbeforeprint onbeforeunload
onblur oncanplay oncanplaythrough onchange
onclick oncontextmenu ondblclick ondrag
ondragend ondragenter ondragleave ondragover
ondragstart ondrop ondurationchange onemptied
onended onerror onformchange onforminput
oninput oninvalid onhashchange onkeydown
onkeypress onkeyup onload onloadeddata
onloadedmetadata onloadstart onmessage onmousedown
onmousemove onmouseout onmouseover onmouseup
onmousewheel onoffline ononline onpause
onplay onplaying onpopstate onprogress
onratechange onreadystatechange onredo onresize
onscroll onseeked onseeking onselect
onshow onstalled onstorage onsubmit
onsuspend ontimeupdate onundo onunload
onvolumechange onwaiting    

Events Defined by Internet Explorer
onactivate onafterprint onbeforeactivate onbeforecut
onbeforedeactivate onbeforeeditfocus onbeforepaste onbeforeprint
onbeforeunload oncontextmenu oncontrolselect oncut
ondeactivate ondrag ondragend ondragenter
ondragleave ondragover ondragstart ondrop
onfilterchange onfocusin onfocusout onlosecapture
onmouseenter onmouseleave onmousewheel onmove
onmoveend onmovestart onpaste onpropertychange
onreadystatechange onresizeend onresizestart onscroll
onselect onselectstart    

Code:

<!
DOCTYPE html>
<
html>
  <head>
      <title>&lt;Example of Body tag&gt;</title>
  </head>
   <body style="background-color:Gray" >
   <p style="width:700px; height:100px; background-color:Silver; font-size:60px; color:White; font-weight:bold; text-align:center"> This is content page.
   </p>         
  </body>

</
html>


<!
DOCTYPE html>
<
html>
  <head>
      <title>&lt;Example of Body tag&gt;</title>
  </head>
   <body style="background-color:Gray" >
   <p style="width:700px; height:100px; background-color:Silver; font-size:60px; color:White; font-weight:bold; text-align:center"> This is content page.
   </p>         
  </body>

</
html>

Output

Internet Explorer

Body tag

Chrome

Body tag

Fire Fox

Body tag

Safari

Body tag
  

Login to add your contents and source code to this article
share this article :
post comment
 

The body tag is not new for HTML5.

Posted by Sam Hobbs Jul 14, 2011
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Nevron Gauge for SharePoint
Become a Sponsor