I am looking to write a web page for IE 8 that has a logo and header div at the top, a content seciton in the middle, and a sticky footer at the bottom. The problem is, I cannot get the content section to take up 100% of what's left. Code below. Whenever I set the height as 100% for the content, there is a 100px over due to the header/logo divs. How can I fix this?
HTML
<%@ Master Language="C#" inherits="DenApp.master"%>
<html>
<head runat="server">
<title>DenApp</title>
<script type="text/javascript" src="javascript/jquery-1.7.1.min.js"></script>
<link rel="Stylesheet" href="./css/master.css" />
</head>
<body>
<div id="master_bodywrapper">
<div id="master_maindiv">
<div id="master_logodiv">
</div>
<div id="master_tabsdiv">
</div>
<div id="master_contentdiv">
<asp:contentplaceholder ID="content" runat="server" />
</div>
</div>
<div id="master_footerdiv">
</div>
</div>
</body>
</html>
CSS
html, body
{
margin:0px;
padding:0px;
height:100%;
width:100%;
}
#master_bodywrapper
{
margin:0px;
padding:0px;
height:100%;
background-color:Black;
}
#master_maindiv
{
background-color:Orange;
padding-bottom:20px;
height:100%;
}
#master_logodiv
{
background-color:Blue;
height:50px;
}
#master_tabsdiv
{
background-color:Green;
height:50px;
}
#master_contentdiv
{
background-color:Yellow;
}
#master_footerdiv
{
background-color:Purple;
height:20px;
position:relative;
margin-top:-20px;
clear:both;
}
Fiddle added at request: http://jsfiddle.net/zZUUW/5/
The answer to my needs are below. Using another div for the header, absolute positioning, and adding a padding-top
to the main div gave me the desired effect.
HTML
<%@ Master Language="C#" inherits="DenApp.master"%>
<html>
<head runat="server">
<title>DenApp</title>
<script type="text/javascript" src="javascript/jquery-1.7.1.min.js"></script>
<link rel="Stylesheet" href="./css/master.css" />
</head>
<body>
<div id="master_bodywrapper">
<div id="master_header">
<div id="master_logodiv">
</div>
<div id="master_tabsdiv">
</div>
</div>
<div id="master_maindiv">
<div id="master_contentdiv">
<asp:contentplaceholder ID="content" runat="server" />
</div>
</div>
<div id="master_footerdiv">
</div>
</div>
</body>
</html>
CSS
html, body
{
margin:0px;
padding:0px;
height:100%;
width:100%;
}
#master_bodywrapper
{
margin:0px;
padding:0px;
height:100%;
background-color:Black;
}
#master_header
{
background-color:Aqua;
position:absolute;
height:100px;
margin:0px;
padding:0px;
left:0px;
top:0px;
}
#master_maindiv
{
background-color:Orange;
height:100%;
}
#master_logodiv
{
background-color:Blue;
height:50px;
}
#master_tabsdiv
{
background-color:Green;
height:50px;
}
#master_contentdiv
{
background-color:Yellow;
padding-top:100px;
height:100%;
}
#master_footerdiv
{
background-color:Purple;
height:20px;
position:relative;
margin-top:-20px;
clear:both;
}