You can’t base a percentage height on an element that has no specific height set or who’s height is controlled by its content. Min-height doesn’t count as height so the height of #wrap is effectively:auto. You would need to change the min-height:100% to height:100% for the above example to work. Of course #wrap is then redundant anyway and can be done without.
80% + 30% = 110% which is too big for anything. I think you meant 80% + 20%
Of course the above structure is totally useless unless you set overflow to auto so that scrollbars will appear on each element when content exceeds the height that you have set.
You can’t really build a layout with coloured divs. You need content and context before you can make decision about how the design can be coded. Whenever you set a fixed height on an element that holds fluid content then you are probably doing something wrong.
If you can elaborate on what you want to achieve we may be able to point you to a more suitable method
That’s an old and broken method and wont work in IE7, 8 or opera and maybe a few others. Read the css faq link I gave you for why.
If you don’t mind simply stretching the image you can do this.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Sticky Footer at Bottom</title>
<style type="text/css">
* {/* for demo only*/
margin:0;
padding:0
}
html, body {
height:100%;/* needed to base 100% height on something known*/
text-align:center;
}
#outer {
width:760px;
background:#ffffcc;
margin:auto;
min-height:100%;
margin-top:-80px;/*footer height - this drags the outer 40px up through the top of the monitor */
text-align:left;
clear:both;
position:relative;
}
* html #outer { height:100% }/* ie6*/
.content {
border-top:80px solid #fff; /* soak up negative margin and allows header to start at top of page*/
width:100%;
position:relative;
z-index:2;
}
#footer {/* footer now sits at bottom of window*/
background:red;
width:760px;
margin:auto;
height:80px;/* must match negative margin of #outer */
clear:both;
}
/*Opera Fix*/
body:before {
content:" ";
height:100%;
float:left;
width:0;
margin-top:-32767px;
}
h1, h2, p { padding:0 10px; }
#outer:after {
clear:both;
display:block;
height:1%;
content:" ";
}
.imgstretch {
position:absolute;
left:0;
top:80px;
width:100%;
bottom:0;
clear:both;/* ie bug*/
}
* html .imgstretch{top:0;height:100%;bottom:auto}
*+html .imgstretch{top:0;height:100%;bottom:auto}
.imgstretch img{
width:100%;
height:100%;
-ms-interpolation-mode:bicubic;
image-rendering: optimizeQuality;
}
</style>
</head>
<body>
<div id="outer">
<div class="content"></div>
<div class="imgstretch"><img src="http://www.ttmt.org.uk/forum/css/1.jpg" alt="" /></div>
</div>
<div id="footer">
<p>Footer</p>
</div>
</body>
</html>
If you want the image scaled with correct aspect and still fill height and width then you will need some js for that and there are a few script around.