I have such html code:
<!DOCTYPE html>
<head>
<title>Untitled Document</title>
<link type="text/css" rel="stylesheet" href="stylesheets.css" />
</head>
<body>
<div id="header"></div>
<div id="left"></div>
<div id="right"></div>
<div id="footer"></div>
</body>
</html>
and a css code:
body{
padding:0px;
}
div {
border-radius: 5px;
border-collapse: collapse;
margin:0px
}
#header {
z-index: 1;
position: fixed;
width: 80%;
height: 60px;
background-color: #000028;
margin: auto;
left: 10%;
}
#left {
width: 20%;
height: 1500px;
background-color: #B9D7D9;
z-index: 2;
position: relative;
float: left;
top: 60px;
left: 10%;
}
#right {
width: 60%;
z-index: 0;
height: 1500px;
background-color: #4AB7FF;
position: relative;
float: right;
right: 10%;
top: 60px;
}
#footer {
height: 50px;
background-color: #668284;
clear: both;
width: 80%;
z-index: 3;
position: relative;
left:10%;
}
When I launch this in Chrome, there are three problems:
1)Total width of #left(20%) and #right(60%) divs is NOT equal to width of #header(80%) despite the percentage sum is equal. Where does it come from? How to make this sum match?
2) There are thin offsets between #header and top of the page and #footer and bottom of the page despite the padding and margins are set to 0px. Where do these offsets come from and how to remove them without using left and top?
3) The footer goes on top of left and right colons despite it is set to be under them (clear:both). How to make it appear below left and right divs?