Does the scroll bar belong to <html>
or <body>
?
I've been writing for every html file,but don't know exactly what it is.
Given the following markup and styling:
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
html {
background: green;
overflow:scroll;
}
body {
background: red;
overflow:scroll;
}
</style>
</head>
<body>
</body>
</html>
We get the following visual results:
Firefox 3.5 http://img98.imageshack.us/img98/3448/ff35.png
Internet Explorer 6 http://img98.imageshack.us/img98/870/ie6.png
Opera 10 http://img22.imageshack.us/img22/1395/o10.png
Google Chrome 3 http://img193.imageshack.us/img193/4300/82451373.png
So, we can style the HTML
element. In fact some people use this in combination with the BODY
tag to get complicated backgrounds.
<html>
has no visual. It just defines that the document is a html document and it contains the head
and the body
.
It's the body
that has the view
.
The scroll bar belongs to the window
if you talk about DOM.
But in CSS, you set scrollbar styles through <body>
If you use Firebug on Firefox and use the element inspector (the one where you can move your mouse and point around elements of the HTML document, and you point it at blank space where there's no elements there, it points to the <body>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With