FANDOM



The <body></body> element surrounds all of a page's content that will actually be rendered on the web page. It is possible to specify a background color or image for the page by using the proper CSS property.

Example code

To apply this in an HTML document, use:

<!DOCTYPE html>
<html>
    <head>
        <title>The title</title>
        Head content
    </head>
    <body>
        Body content
    </body>
</html>

Attributes

As of HTML 4.0, all presentational attributes on the body are deprected in favor of CSS.[1][2]

Rendering

Most graphical web browsers add an 8 pixel margin around the body contents.

Typical CSS representation:

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

Coding rules

The <body> element is the second element inside the <html> element. (The <head> element is the first one.) Inside the <body> element, only elements from the Flow content category are allowed. The <body> element itself belongs to the Sectioning root category.

Both the start and end tags are optional. The <body> element is automatically generated when the tags are not used.

References

  1. http://www.w3.org/TR/REC-html40/struct/global.html#edef-BODY
  2. http://dev.w3.org/html5/spec/Overview.html#the-body-element-0

External links

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.