Body в html что это
Тег <body> (от англ. body — тело) предназначен для хранения содержимого веб-страницы (контента), отображаемого в окне браузера.
Информацию, которую следует выводить в документе, следует располагать именно внутри контейнера <body> . К такой информации относится текст, изображения, теги, скрипты JavaScript и т. д.
<body> также применяется для определения цветов ссылок и текста на веб-странице. Подобная практика в HTML осуждается и взамен для указания цветовой схемы рекомендуется использовать стили, применяя их к селектору body .
Часто <body> используется для размещения обработчика событий, например, onload , которое выполняется после того, как документ завершил загрузку в текущее окно или фрейм.
Открывающий и закрывающий теги <body> на веб-странице не являются обязательными, однако хорошим стилем считается их использование, чтобы определить начало и конец HTML-документа.
HTML <body> Tag
The <body> element contains all the contents of an HTML document, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
Note: There can only be one <body> element in an HTML document.
Browser Support
| Element | |||||
|---|---|---|---|---|---|
| <body> | Yes | Yes | Yes | Yes | Yes |
Global Attributes
Event Attributes
More Examples
Example
Add a background image to a document (with CSS):
Example
Set the background color of a document (with CSS):
Example
Set the color of text in a document (with CSS):
Example
Set the color of unvisited links in a document (with CSS):
Example
Set the color of active links in a document (with CSS):
Example
Set the color of visited links in a document (with CSS):
Related Pages
HTML DOM reference: Body Object
Default CSS Settings
Most browsers will display the <body> element with the following default values:
Example
body <
display: block;
margin: 8px;
>
body:focus <
outline: none;
>
COLOR PICKER
SUBSCRIBE!
Contacts
If you want to report a bug, as well as make an offer for the site, add an ad or advertisement on the site, do not hesitate to send an email to the admin:
Top Tutorial
Top References
Top Examples
Web Certificates
This site is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.
You can also use the Ukrainian version of the site W3Schools українською.
Copyright 1999-2024 by Refsnes Data. All Rights Reserved.
W3Schools is Powered by W3.CSS.
HTML <body> Tag
The <body> element contains all the contents of an HTML document, such as headings, paragraphs, images, hyperlinks, tables, lists, etc.
Note: There can only be one <body> element in an HTML document.
Browser Support
| Element | |||||
|---|---|---|---|---|---|
| <body> | Yes | Yes | Yes | Yes | Yes |
Global Attributes
Event Attributes
More Examples
Example
Add a background image to a document (with CSS):
Example
Set the background color of a document (with CSS):
Example
Set the color of text in a document (with CSS):
Example
Set the color of unvisited links in a document (with CSS):
Example
Set the color of active links in a document (with CSS):
Example
Set the color of visited links in a document (with CSS):
Related Pages
HTML DOM reference: Body Object
Default CSS Settings
Most browsers will display the <body> element with the following default values:
Example
body <
display: block;
margin: 8px;
>
body:focus <
outline: none;
>

COLOR PICKER


Report Error
If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:
Thank You For Helping Us!
Your message has been sent to W3Schools.
Top Tutorials
Top References
Top Examples
Get Certified
W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.
HTML <body> Tag
The <body> tag defines a web page content (text, images, links, etc.). It is placed inside the <html> element, after the <head> element. In an HTML document, we can use only one <body> tag.
Commonly, a list of content-specific CSS classes is placed within the <body> element allowing JavaScript developers and designers to target pages easily. Even if these classes are not used, they won’t cause any problems.
Syntax
The <body> tag comes in pairs. The content is written between the opening (<body>) and closing (</body>) tags.