Hi,
I should have saved this for one of my CSS quizzes but you can do it for IE8+ like this:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style>
html, body {
height:100%;
margin:0;
padding:0
}
#wrap {
height:100%;
width:100%;
display:table;
overflow:hidden;
}
*+html #wrap { min-height:100% }
#outer {
background:red;
position:relative;
width:800px;
margin:auto;
padding:1px 0;
}
#foot {
height:50px;
background:blue;
width:800px;
margin:auto;
position:relative;
}
#shadow {
position:absolute;
margin:50px 0 0 -50px;
width:900px;
background:#000;
height:100px;
}
</style>
</head>
<body>
<div id="wrap">
<div id="outer">
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
<div id="foot">
<div id="shadow"></div>
</div>
</div>
</body>
</html>
The secret is the 100% high display:table element which has overflow:hidden added. That allows anything less than 100% to show but cuts off anything once below the fold. The inner content is ok because tables always expand the 100% height and treat it like min-height so the actual content doesn't get cut off.
Needs to be tested first but seems to do the job
Bookmarks