HTML <body> Tag
The <body> tag in HTML is used to define the main content present inside an HTML page. It is always enclosed within <HTML> tag. The <body> tag is the last child of the <html> tag. The <body>
tag contains all the contents of an HTML document, such as headings, images, hyperlinks, tables, lists, paragraphs, etc.
Syntax:
<body> Body Contents... </body>
Attributes:
There are many attributes in the <body> tag that are depreciated from HTML5 are listed below:
Attribute Values |
Description |
---|---|
It contains the URL of the background image. It is used to set the background image. |
|
It is used to specify the background color of an image. |
|
It is used to specify the color of the active link. |
|
It is used to specify the color of visited links. |
|
It specifies the color of the text in a document. |
|
It specifies the color of visited links. |
Example 1: In this example we will use HTML body tag in which all content placed inside the body tag.
HTML
<!DOCTYPE html> < html lang = "en" > < head > < title >Document</ title > </ head > <!-- body tag starts here --> < body > < h1 >w3wiki</ h1 > < h2 >body Tag</ h2 > < p >This is paragraph text</ p > </ body > <!-- body tag ends here --> </ html > |
Output:
Example 2: In this example we will show the functioning of a Body tag along with its CSS implementation.
HTML
<!DOCTYPE html> < html lang = "en" > < head > < title >Document</ title > </ head > <!-- style on the body tag --> <!-- body tag starts here --> < body style = "background-color:seagreen" > < h1 >w3wiki</ h1 > < h2 >HTML body Tag</ h2 > < p > This is paragraph Tag </ p > </ body > <!-- body tag ends here --> </ html > |
Output: sou
Supported Browsers:
- Google Chrome 1
- Edge 12
- Firefox 1
- Opera 15
- Safari 1
Contact Us