In this section, we will learn what HTML <body> element is and how it works.
What is <body> Tag in HTML?
HTML <body> element represents the main body of an HTML document. Basically, this is where we design and put the structure and content of a webpage. So it’s a container for the body of a webpage.
HTML <body> Tag Syntax:
<body> webpage content </body>
HTML <body> Tag Values
The content, like images, articles, comments, and their structures, are part of the values that we usually put within the body of the <body> element.
Example: using <body> tag in HTML
See the Pen using <body> tag in HTML by Omid Dehghan (@odchan1) on CodePen.
Example: body background color in HTML
See the Pen body background color in HTML by Omid Dehghan (@odchan1) on CodePen.
To change the background color of the <body> element, we can use the CSS background-color property (as we did in the previous example).
Example: body background image in HTML
See the Pen body background image in HTML by Omid Dehghan (@odchan1) on CodePen.
We can also use the CSS background-image to set an image as the background of the <body> element.