body Element

Description

The body element encapsulates the content of an HTML document ,while the head element encapsulates metadata and document information.

The body element always follows the head element so that it is the second child of the html element.

Obsolete

The body element's attributes from HTML4: alink, background, bgcolor, link, margintop, marginbottom, marginleft, marginrightm, marginwidth, text, and vlink, are obsolete.

The effect that these attributes had can be achieved with CSS.

Example

The following code shows the body element in use.


<!DOCTYPE HTML>
<html>
    <head>
       <title>Example</title>
    </head>
<body>
    <p>This is a test</p>
    <a href="http://java2s.com">Visit  java2s.com</a>
</body><!--from   ww w. j  a v  a 2s .c o  m-->
</html>

Click to view the demo

One p element and one a element are added to the body element.





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed