I know the answer to this question will be simple, but I have a pretty simple HTML page with 3 divs - header, map_canvas and sidebar. I have CSS to put it all where I need to. But for some reason, I get scrollbars in the browser window, and I don't want them there, I just want the page to fit the height and width of the window. Any help is greatly appreciated.
My page consists of this HTML:
<!doctype html>
<html>
<head>
<title>CSS Exercise</title>
<link rel="stylesheet" href="css/style.css" />
<script src="js/script.js"></script>
</head>
<body onload="initialize()">
<div class="header"></div>
<div id="map_canvas"></div>
<div class="sidebar">
<input id="lat" type="text" />
<input id="lng" type="text" />
</div>
</body>
</html>
And this CSS:
body {
height: 100%;
width: 100%;
}
html {
height: 100%;
}
.header {
width: 100%;
}
#logo {
display: block;
margin-left: auto;
margin-right: auto;
margin-bottom: 8px;
}
.sidebar {
float: right;
width: 20%;
height: 100%;
text-align: center;
}
#map_canvas {
float: left;
width: 80%;
height: 100%;
}
JSFiddle link
source
share