Tag ( doubles) is designed to store the content of a web page (content) displayed in a browser window. The information that should be displayed in the document should be located inside the BODY container. This information includes text, images, tags, JavaScript, etc.
The tag is also used to define the colors of links and text on a web page. This practice is deprecated in HTML 4 and instead it is recommended to use styles to specify a color scheme by applying them to the selector. However, most options are still supported across browsers.
Often a tag is used to place an event handler, such as onLoad, that runs after the document has finished loading into the current window or frame.
The opening and closing BODY tags on a web page are optional, but it is good style to use them to define the beginning and end of an HTML document.
Syntax
...
Closing tag
Required.
Options
alink - sets the color of the active link.
background - sets the background image on the web page.
bgcolor - web page background color.
bgproperties - determines whether to scroll the background along with the text or not.
bottommargin - indent from the bottom edge of the browser window to the content.
leftmargin - horizontal margin from the edge of the browser window to the content.
link - link color.
scroll - sets whether to display scroll bars or not.
text - the color of the text in the document.
topmargin - indent from the top edge of the browser window to the content.
vlink - color of visited links.
Example 1: Using the BODY tag
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diem nonummy nibh euismod tincidunt ut lacreet dolore magna aliguam erat volutpat.
Ut wisis enim ad minim veniam, quis nostrud exerci tution ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
Description of BODY tag parameters ALINK parameter
Description
Sets the color of the active link. The current link color changes to the active color when the link is clicked with the mouse cursor or selected using the keyboard.
Syntax
...
Arguments
The color value can be set in two ways.
1. By its name
Browsers support some colors by their name.
2. By hexadecimal value
Hexadecimal numbers are used to specify colors. The hexadecimal system, unlike the decimal system, is based, as its name suggests, on the number 16. The numbers will be as follows: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C , D, E, F. Numbers from 10 to 15 are replaced by Latin letters. Numbers greater than 15 in the hexadecimal system are formed by combining two numbers into one. For example, the number 255 in decimal corresponds to the number FF in hexadecimal. To avoid confusion in determining the number system, a hash symbol # is placed before the hexadecimal number, for example #666999. Each of the three colors - red, green and blue - can take values from 00 to FF. Thus, the color symbol is divided into three components #rrggbb, where the first two symbols indicate the red component of the color, the middle two - green, and the last two - blue.
Default value
Matches the link color.
...
Description
Specifies the image to be used as the wallpaper. Unlike regular images, the background has no width or height set and is always displayed at full size at 100%. If the picture is smaller in size than the browser window, then the picture is repeated horizontally to the right and down, lining up like a mosaic. For this reason, visible differences may occur at the junction of background images, noticeable to site visitors. When choosing a background image, make sure there is enough contrast between it and the text on the web page. Animated GIFs can be used as backgrounds, but they will distract the reader's attention.
Syntax
...
Arguments
Any valid image address - you can use a relative or absolute path.
Default value
No.
Example 3: Setting a wallpaper on a web page
...
Description
Sets the background color of the web page. You can use this parameter in conjunction with background, choosing a background color close to the background image
Syntax
...
Arguments
See ALINK parameter.
Default value
Depends on the browser and its version, but the background color is usually white.
Example 4: Setting the background color of a web page
...
Description
By default, the background image scrolls with the content of the web page. Using the bgproperties parameter you can fix the background in one place and thus force only the content to scroll. This quality of a web page is rarely used for websites, so it may seem strange and unusual to users.
Syntax
...
Arguments
There is only one fixed parameter, which fixes the background. If you want to remove this feature, remove the bgproperties parameter from the BODY tag or set it to an empty value - "".
Default value
No.
Example 5: Fixing the background
...
Note
- Not all browsers support this setting; for example, Netscape ignores it.
- It has been noticed that when setting a background image on a web page through styles, the bgproperies parameter stops working.
Description
Defines the amount of space from the left and right edges of the browser window to the web page content.
Syntax
...
Arguments
A positive integer that specifies the offset in pixels.
Default value
10 pixels for Windows and 8 pixels for Macintosh.
Example 6: Changing the left margin
...
Note
- The Netscape browser does not understand the leftmargin parameter; to set margins, it uses the parameters marginwidth - horizontal margins and marginheight - vertical margins.
- To set the margins from the right, bottom, and top edges, use the rightmargin, bottommargin, and topmargin parameters, respectively.
Description
Sets the color of unvisited links.
Syntax
...
Arguments
See ALINK parameter.
Default value
#0000FF
Example 7: Setting the color of links
...
Description
The scroll parameter controls the presence of scroll bars in the browser window when the content of a web page exceeds the size of the current window. This setting only works in Internet Explorer.
Syntax
...
Arguments
yes - displays scroll bars.
no - prevents scroll bars from being shown in the window.
Default value
yes
Example 8: Hiding the scrollbar
...
Description
Sets the default color of text used on a web page. The colors of individual elements can be easily changed using styles.
Syntax
...
Arguments
See ALINK parameter.
Default value
#000000
Example 9: Changing text color
...
Description
Defines the color of visited links, i.e., links that the user has already “clicked”.
Syntax
...
Arguments
See ALINK parameter.
Default value
#551a8b (Navigator 4); #800080 (Internet Explorer Windows); #006010 (Internet Explorer Macintosh).
Example 10: Setting the color of visited links
...
The element (from the English “body” - “body”) is designed to store the content of a web page (content) displayed in the browser window (text, links, pictures (images), tables, lists, etc.).
Note: An element's opening tag can be omitted unless the first element is a space character, comment, or . The closing tag may be omitted if the body element has content or a start tag and is not immediately followed by a comment.
Syntax ... Closing tagNot required.
alink Attributes Deprecated in HTML5 Sets the color of the active link. Use the CSS color property instead in combination with the :active pseudo-class. background Deprecated in HTML5 Specifies a background image on a web page. Use the CSS background property instead. bgcolor Deprecated in HTML5 The background color of a web page. Use the CSS background-color property instead. bgproperties Deprecated in HTML5 Determines whether the background should be scrolled along with the text or not. Use the CSS background-attachment property instead. bottommargin Deprecated in HTML5 Margin from the bottom edge of the browser window to the content. Use the CSS margin-bottom property instead. leftmargin Deprecated in HTML5 The horizontal margin from the left edge of the browser window to the content. Use the CSS margin-left property instead. link Deprecated in HTML5 The color of links on a web page. rightmargin Deprecated in HTML5 The margin from the right edge of the browser window to the content. Use the CSS margin-right property instead. scroll Deprecated in HTML5 Sets whether to display scrollbars or not. Use the CSS overflow property instead. text Deprecated in HTML5 The color of the text in the document. Use the CSS color property instead. topmargin Deprecated in HTML5 The margin from the top edge of the browser window to the content. Use the CSS margin-top property instead. vlink Deprecated in HTML5 Color of visited links. Use the CSS color property instead in combination with the :visited pseudo-class.Global attributes and events are available for this element.
Default stylingMost browsers will render the element with the following default CSS values:
Body ( display: block; margin: 8px; ) body:focus ( outline: none; )
Differences between HTML 4.01 and HTML5All previously used attributes have been removed from HTML5.
Usage example: Element Example HTML: Try it yourself Document title Document content... SpecificationsWHATWG HTML Living Standard (WHATWG) | Living Standard |
HTML 4.01 (W3C) | Recommendation |
HTML5 (W3C) | Recommendation |
HTML 5.1 (W3C) |