I’m designing my first non-table based website and running into problems since DIVs do not behave like table rows and cells. The page has 3 DIVs (header, article, footer) inside a wrapper upon which I have a drop shadow. The header has a height of 115px. The footer: 25px. The article’s height is: calc(100% - 135px); The article correctly calculates its height and pushes the footer to the bottom of the wrapper.
The problem is that:
If I make the wrapper have a fixed height of 100%, the article correctly calculates its height and pushes the footer to the bottom of the screen (height of wrapper). The article can even grow to hold its entire contents. The problem is that the wrapper does not expand beyond 100% (height of screen) and the shadow only extends one screen length down even if its contents extend further down the screen.
If I make the wrapper’s height not absolute by setting min-height: 100%, to encompass its contents as they grow and shrink , the article DIV extends correctly to the height of the wrapper but both the article and wrapper only extend far enough to encompass the article contents. This can leave a lot of blank space in the browser window. How do I tell the wrapper to have a minimum height of the screen and extend beyond to wrap the entire contents while allowing the article div to correctly calculate its height such that the 3 divs extend to the height of the wrapper?
HTML:
<!DOCTYPE HTML >
<html>
<head>
<link rel="stylesheet" type="text/css" href="/stylesheet.css">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<page >
<wrapper class="shadow" style="width:75%; margin:0 auto; min-width:300px; min-height:100%; height:100%; margin-bottom:10px;" >
<header > </header>
<article > </article>
<footer ></footer>
</wrapper>
</page>
</body>
</html>
CSS:
header{
display:block;
background-image: url('http://10.5.0.43:89/images/bg.jpg');
height:115px;
width:100%;
margin:auto;
text-align:left;
background-color:#ffffff;
vertical-align:bottom;
}
article{
width:100%;
margin:0 auto;
vertical-align:top;
background-color:#ffffff;
padding:0;
height: calc(100% - 135px) !important;
}
footer{
background-color:#4E70AF;
width:100%;
margin:auto;
height:25px;
font-size:8pt;
color:white;
font-face:arial;
text-align:center;
line-height:25px;
}
html, body{
height:99%;
background-color:#CCC;
in-width:300px;
}
.shadow{
box-shadow: 0px 0px 18px rgba(0, 0, 0, .7);
}