ToC ~ Up ~ Prev ~ Next ~ Index |
Introduction to HTML Last Update: 25 September 2000 |
The BODY element contains all the content of a document, as opposed to the HEAD, which contains information about the document. Various mark-up elements are allowed within the body to indicate headings, paragraphs, lists, hypertext links, images, and so on. These are described and illustrated in documents following this one.
The following shows typical use of HEAD and BODY elements, using this document as an example:
<HTML> <HEAD> <TITLE> BODY element in HTML </TITLE> <BASE HREF="http://www.utoronto.ca/webdocs/HTMLdocs/NewHTML/body.html"> </HEAD> <BODY> [<a href="htmlindex.html">ToC</a>] [<a href="htmlindex.html">Up</a>] <H1> BODY Element in HTML </H1> <p> The BODY element contains all the content of the document, as opposed to the <a href="head.html">HEAD</a>, which contains information about the document. </p>...... </BODY> </HTML>
In HTML 2.0, the BODY element had no attributes. Netscape 1.1 introduces the single attribute BACKGROUND. This allows you to specify an image file to use as a background (a bit like a watermark) behind the displayed text and graphics.
The following example (please read the following text and then follow the example link)
<BODY BACKGROUND="back/marble.gif"> <h1> Bla Bla Bla </h1> <p> And still more text.... </BODY>
tiles the window background with the designated GIF image. Just click on the anchor to look at the example.
Setting a background color is not enough -- for example, if you set the background to black, you need to be able to change the color of the text as well. Netscape introduced several new attributes for controlling the text color. These are described below, and became, as of HTML 3.2, part of the HTML standard. There is also an example document illustrating these BODY attributes.
Most browsers also support special color names (white, blue, etc.). A list of the allowed colors is found at the supporting Web site for my HTML book, at: http://www.utoronto.ca/ian/books/html4ed/appf/color1.html.
These browsers added attributes that set the padding around the text the page -- essentially setting the page margins. Of course, the two companies selected different names for these attributes. These properties are:
ToC ~ Up ~ Prev ~ Next ~ Index |
Introduction to HTML © 1994-1998 by Ian Graham Last Update: 25 September 2000 |