1. Home
  2. Computing & Technology
  3. Web Design / HTML

<body></body>

By Jennifer Kyrnin, About.com

< Previous | HTML 4.01 Tags / XHTML 1.0 Elements | Next >

Free XHTML 1.0 Class | HTML Validators | Free HTML 4.01 Class

<body> Description:

The <body> tag is the contents of the document. The only time an XHTML documen will not have a <body> tag is when it is a frameset.

<body> Web Browser Support:

<body> Attributes:

All attributes are optional unless indicated.

<body> End Tag:

</body> REQUIRED

<body> Contents:

CDATA.The <body> tag encloses the content that will display on the web page. The following tags are valid within the <body> tag:
a, abbr, acronym, address, applet, b, basefont, bdo, big, blockquote, br, button, center, cite, code, dfn, dir, div, dl, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, iframe, img, input, isindex, kbd, label, map, menu, noframes, noscript, object, ol, p, pre, q, s, samp, script, select, small, span, strike, strong, sub, sup, table, textarea, tt, u, ul, var

<body> Valid Context:

The <body> tag is valid within the following tags:
html, noframes

<body> Usage:

  • standard <body> tag:
    <html>
    <head>
    <title>Title</title>
    </head>
    <body>
    contents of page
    </body>
    </html>
    View the source of any XHTML document to see the body element at work.

<body> Special Notes:

  • While this tag is technically optional according to the specification, leaving it out may confuse some browsers. And the XHTML DTD expects it.
  • Attributes that are deprecated in HTML 4.0 should be replaced with CSS (Cascading Style Sheets) where possible.
  • A common error when indicating colors in the <body></body> tag is to leave out the #-sign on hexadecimal triplets. Some browsers recognize the triplets, while others attempt to assign that text to a named color value. This can result in strange colors displaying on the page.

More <body> Information

< Previous | HTML 4.01 Tags / XHTML 1.0 Elements | Next >

Free XHTML 1.0 Class | HTML Validators | Free HTML 4.01 Class

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. HTML and XHTML
  5. XHTML
  6. HTML Tags
  7. The body Element - The Document's Content - XHTML 1.0 HTML 4.0

©2008 About.com, a part of The New York Times Company.

All rights reserved.