I've created a html file, with a header div, a content div and a footer div. The scrollbar should show up for the "bodyDiv" tag (and it does).
Now to my question: Why is the content inside the "bodxDiv" larger than the screen height? So the scrollbar appears - also if there is no need for it.
At the picture you can see, that the content ends after the red line, but there is stil a scrollbar
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div id="bodyDiv">
<div id="mainDiv">
<div id="headDiv">Header</div>
<div id="contentDiv">Content</div>
<div id="footerDiv">Footer</div>
</div>
</div>
</body>
</html>
style.css
<style type="text/css">
* {
margin: 0;
padding: 0;
}
html *
{
color: #000;
font-family: "Arial", Arial, sans-serif;
}
body, html {
width: 100%;
height: 100%;
overflow: hidden;
}
#bodyDiv {
position: absolute;
top: 0;
left: 0;
z-index: 2;
overflow: auto;
width: 100%;
height: 100%;
text-align: center;
}
#mainDiv {
width: 600px;
height: 100%;
text-align: left;
margin: 18px auto;
}
#headDiv {
border: 1px solid #000;
}
#contentDiv {
border: 1px solid #000;
margin-top: 6px;
}
#footerDiv {
border: 1px solid #000;
margin-top: 6px;
}
</style>