HTML Tag Reference - HTML tag <body>








<body> defines the main content of an HTML document.

Browser compatibility

<body> Yes Yes Yes Yes Yes

What's new in HTML5

All layout attributes are deprecated in HTML5.

Attribute

alink
Not supported in HTML5. Set the color value for active links
background
Not supported in HTML5. Set a background image URL for a document.
bgcolor
Not supported in HTML5. Set the document background color.
link
Not supported in HTML5. Set the color of unvisited links.
text
Not supported in HTML5. Set the text color.
vlink
Not supported in HTML5. Set the visited link color.

Global Attributes

The <body> tag supports the Global Attributes in HTML.

Event Attributes

The <body> tag supports the Event Attributes in HTML.

Default CSS Settings

body { 
    display: block;
    margin: 8px;
}

body:focus { 
    outline: none;
}




Example

demo showing how to use body tag.

<html>
<head>
<title>body element example</title>
</head>
<body>
     <p>This is a test.</p>
</body>
</html>

Click to view the demo