As shown, the height of the body is only 44 pixels.
I then set the body's background-color
.
As a result, the background color of the entire web page, even the parts outside of the body area, is changed. Why does this happen?
As shown, the height of the body is only 44 pixels.
I then set the body's background-color
.
As a result, the background color of the entire web page, even the parts outside of the body area, is changed. Why does this happen?
Body tag is used or applied for whole page not the any single line or specific items..
But if you want to change the some height of the page which are different from the <body>
tag then...
you can create the <div>
tag and set it to the height of 44px
and set the color of this div as you wanted to color...
And placed inside the <body> tag
. Now its the different color from the tag...
The <body>
tag in HTML is the entire webpage, not just a 44-pixel strip at the top. When you change the background-color
of a webpage, the background of the entire page will change. There was probably just a glitch in the developer tools in your first screenshot that showed the <body>
as such a small area.
From w3schools:
The
<body>
element contains all the contents of an HTML document, such as text, hyperlinks, images, tables, lists, etc.