Pages

Monday, December 6, 2010

The Body Element or the Document Body


The <body> element contains all the content to your document. The <body> element comes after the document header and must be closed before closing the document root, <html>.



Listed below are the most common attributes you can use for this element:
  • alink – sets a color value or a predefined color name of the hyperlinks when they’re being clicked.
  • background – provides the Uniform Resource Locator (URL) of an image file to be used as web browser’s background.
  • bgcolor – sets a color value or a predefined color name of the web browser’s background.
  • bottommargin – sets the bottom margin in pixels (px) using Internet Explorer or Safari web browser.
  • class – provides the class or classes of the body. This attributes is used to identify the name of the style class or classes to be used for rendering.
  • id – provides a unique name for the body.
  • lang – provides the language in which the enclosed content is coded.
  • leftmargin – sets the left margin in pixels (px) using the Internet Explorer or Safari web browser.
  • link – sets a color value or a predefined color name of the hyperlinks to those haven’t been visited.
  • marginheight – sets the margin height in pixels (px) using Mozilla web browser.
  • marginwidth – sets the margin width in pixels (px) using Mozilla web browser.
  • ·         Rightmargin – sets the right margin in pixels (px) using Internet Explorer or Safari web browser.
  • style – provides a cascading style sheet (CSS) properties to the element.
  • text – sets a color value or a predefined color name of the text in the document.
  • title – provides a text title for the body. Most web browser displays the value of the title as a “tooltip”.
  • topmargin – sets the top margin in pixels (px) using Internet Explorer or Safari web browser.
  • vlink – sets a color value or a predefined color name of the hyperlinks to those has been visited.


Here’s another example that we’ve already seen. Note the use of the <body> element:

<!DOCTYPE> html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional .dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
     <head>
           <meta http-equive="Content-Type" content="text/html;
charset=utf-8" />
            <title>Document Body Example</title>
      </head>

      <body>
            <h1>
                  Document Body Example
            </h1>
       </body>
</html>


Here’s an example to set a top margin of 100 pixels and a left margin of 200 pixels to a document that can be viewed in Internet Explorer or Safari web browser:

<!DOCTYPE> html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional .dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
     <head>
           <meta http-equive="Content-Type" content="text/html;
charset=utf-8" />
            <title>Document Body Example</title>
      </head>

      <body topmargin=”100” leftmargin=”200”>
            <h1>
                  Document Body Example
            </h1>
       </body>
</html>


Here’s an example to set margin height of 100 pixels and a margin width of 200 pixels to a document that can be viewed in Mozilla web browser:


<!DOCTYPE> html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional .dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
     <head>
           <meta http-equive="Content-Type" content="text/html;
charset=utf-8" />
            <title>Document Body Example</title>
      </head>

      <body marginheight=”100” marginwidth=”200”>
            <h1>
                  Document Body Example
            </h1>
       </body>
</html>


 

0 comments:

Post a Comment