Computer lessons

Insert the code between the body tags. HTML tags html, head, body

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.



...

BACKGROUND parameter

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



...

BGCOLOR parameter

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



...

BGPROPERTIES parameter

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.
LEFTMARGIN parameter

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.
LINK parameter

Description
Sets the color of unvisited links.

Syntax
...

Arguments
See ALINK parameter.

Default value
#0000FF

Example 7: Setting the color of links



...

SCROLL parameter

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



...

TEXT parameter

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



...

VLINK parameter

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 tag

Not 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 styling

Most 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 HTML5

All previously used attributes have been removed from HTML5.

Usage example: Element Example HTML: Try it yourself Document title Document content... Specifications Specification Status

Element (from English. body- body) is designed to store the content of a web page (content) displayed in the browser window. The information that should be displayed in the document should be located inside the container. This information includes text, images, tags, JavaScript, etc.

also used to determine the colors of links and text on a web page. This practice is frowned upon in HTML and instead it is recommended to use styles to specify a color scheme, applying them to the body selector.

Often used to place an event handler, such as onload, that runs after the document has finished loading into the current window or frame.

Opening and closing tags are optional on a web page, but it is good style to use them to define the beginning and end of an HTML document.

Syntax

...

Closing tag

Not required.

AttributesExample

BODY

Even Aristotle in his “Politics” said that music, influencing a person, delivers “a kind of purification, that is, relief associated with pleasure.”

The result of the current example is shown in Fig. 1. When using the onload event of an element, a script written in JavaScript is executed, in this case it displays a message that the document has been loaded.

Rice. 1. Pop-up window in a document

Specification

Each specification goes through several stages of approval.

  • Recommendation - The specification has been approved by the W3C and is recommended as a standard.
  • Candidate Recommendation - The group responsible for the standard is satisfied that it meets its goals, but requires help from the development community to implement the standard.
  • Proposed Recommendation - At this stage, the document is submitted to the W3C Advisory Council for final approval.
  • Working Draft - A more mature version of a draft that has been discussed and amended for community review.
  • Editor's draft (Editorial draft) - a draft version of the standard after amendments have been made by the project editors.
  • Draft (Draft specification) - the first draft version of the standard.

The living HTML standard (Living) stands out - it does not adhere to traditional version numbering, since it is under constant development and is updated regularly.

Description

The element 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 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, applying them to the BODY selector. However, most attributes are still supported across browsers.

Often a tag is used to place an event handler, for example, that runs after a document has finished loading into the current window or frame.

Opening and closing tags are optional on a web page, but it is good style to use them to define the beginning and end of an HTML document.

Syntax... Attributes Sets the color of the active link. Sets the background image on a web page. Web page background color. Determines whether the background scrolls along with the text or not. The distance from the bottom edge of the browser window to the content. The horizontal distance from the left edge of the browser window to the content. The color of links on a web page. The distance from the right edge of the browser window to the content. Sets whether to display scrollbars or not. The color of the text in the document. The distance from the top of the browser window to the content. Color of visited links. Closing tag

The opening and closing tags are optional.

HTML5 IE Cr Op Sa Fx

Tag BODY

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.

The result of the current example is shown in Fig. 1. When using the onload event of a tag, a script written in JavaScript is executed, in this case it displays a message that the document has been loaded.

Rice. 1. Pop-up window in a document

BODY tag attributes are very important in creating an html page, because they affect all its content.

BODY tag attributes are very important in creating an html page, because they affect all its content. When opening a page, the browser first looks at this tag and its attributes. However, we must remember that the BODY tag is not used to insert any video, picture or text anywhere on the page. This is all done using other tags. I'll look into it later Cascading Style Sheets (CSS), with which you can also place or change various contents of an html page. As I already said, many textbooks describe everything in a row, but I will do it differently. I will describe only the main thing about the BODY tag. I will show you the main attributes of the BODY tag, their features and benefits.

What are the main attributes of the BODY tag?

bgcolor— background color of the html document. All browsers fill the entire document with white by default (however, in some you can set your own default color). If you decide to make the page background gray, then you need to write the following:

In HTML, colors can be represented in different forms. You can write the color in English or in hexadecimal (hex) value. For convenience, you can use the so-called Web palette, in which everything is beautifully and clearly described, what color and how it is written. If you use exactly these color values, then you don’t have to worry that the color will be displayed differently in different browsers. All colors of the Web palette can be found in the corresponding subsection of the Application. hex values ​​work according to the RGB model, i.e. the first two digits are the shade of red (Red), the second two digits are the shade of green (Green), and the last two digits are the shade of blue (Blue). By the way, if the Web palette does not contain the color you need, you can find it in the wonderful ColorT Final program.

And so, I’ve written everything with colors, now we can talk about the attributes of the BODY tag:

background— an attribute of the BODY tag, with which you can set a picture as the background of the entire page. For example, there is a picture fon..gif. In order to make this picture the background of an html document, you need to write it like this:

This example was for the ordered arrangement of files on your site; if the file is simply in the root of the site, then you can write it like this:

If fon.gif is located in the images subdirectory of the directory with relative to the page, then you can write this:

I advise you to take a small and simple image for the background, because you want it to weigh little, and since it fills the entire page, it creates a single background. . With the drawings I think everything, let's move on:

text— sets the text color of your html page. Let's say we wanted to make the text on the page red:

The following attributes will help us customize the display of links on our page:

For example, you decide to make the color of links that have not yet been clicked green (#008000), but those that have already been clicked blue (#0000FF), then we write it like this:

The BODY tag has quite a lot of attributes, I focused on the main ones for you. If you don't set link colors, browsers have standard default colors. To reinforce the material, let's make a page with a gray background, blue text, unused links in yellow, and visited links in green. This is what we end up with:

You can type this html code in any text editor, including a visual one. I advise you to type the code manually to consolidate your knowledge. don’t forget to insert some text between the and tags, then save this file under any name with the html extension. You open the resulting file in any browser convenient for you and enjoy working :) .

In addition to personal attributes (i.e. attributes that are used only in this tag), you can write attributes of other tags in the BODY tag (this rule applies to many other tags). I will write about this in other materials in this section. The main thing is to experiment and always learn something new.

Publication date: May 15, 2012
WHATWG HTML Living Standard (WHATWG) Living Standard
HTML 4.01 (W3C) Recommendation
HTML5 (W3C) Recommendation
HTML 5.1 (W3C)