|
|
HTML <body> tag
Syntax
<body> - </body>
Definition and Usage
The body element contains the documents' body, like text, images, colors,
graphics, ...
The <body> tagis required in non-frames
documents, but its start and end tags are always optional.
Optional Attributes
| Attribute |
Value |
Description |
| alink |
rgb(x,x,x), #rrggbb or colorname |
Specify the color of the active links in the document. Deprecated.
Use styles instead. |
| background |
file_name |
An image file to be used as the background. Deprecated.
Use styles instead. |
| bgcolor |
rgb(x,x,x), #rrggbb or colorname |
The background color of the document. Deprecated.
Use styles instead. |
| link |
rgb(x,x,x), #rrggbb or colorname |
Specify the color of all the links in the document. Deprecated.
Use styles instead. |
| text |
rgb(x,x,x), #rrggbb or colorname |
Specify the color of the text in the document. Deprecated.
Use styles instead. |
| vlink |
rgb(x,x,x), #rrggbb or colorname |
Specify the color of the visited links in the document. Deprecated.
Use styles instead. |
Standard Attributes
| id, class, title, style, dir, lang, xml:lang |
For a full description, go to Standard
Attributes.
Event Attributes
| onload, onunload, onclick, ondblclick, onmousedown,
onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown,
onkeyup |
For a full description, go to Event Attributes.
Example
| Source |
Output |
Deprecated example
<HTML>
<HEAD>
<TITLE>This is a test document</TITLE>
</HEAD>
<BODY bgcolor="white" text="black"
link="red" alink="fuchsia" vlink="maroon">
... document body...
</BODY>
</HTML>
Using style sheets, the same effect could be accomplished as follows:
<HTML>
<HEAD>
<TITLE>This is a test document</TITLE>
<STYLE type="text/css">
BODY { background: white; color: black}
A:link { color: red }
A:visited { color: maroon }
A:active { color: fuchsia }
</STYLE>
</HEAD>
<BODY>
... document body...
</BODY>
</HTML>
Using external (linked) style sheets gives you the flexibility to
change the presentation without revising the source HTML document:
<HTML>
<HEAD>
<TITLE>This is a test document</TITLE>
<LINK rel="stylesheet" type="text/css" href="smartstyle.css">
</HEAD>
<BODY>
... document body...
</BODY>
</HTML>
|
N/A |
|
|