If you are placing it in a sticky footer then you will probably have to go with a fixed height banner.
Something like this:
Code:
<!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:930px;
background:#fcf;
margin:auto;
min-height:100%;
margin-top:-40px;/*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% }
#header {
background:red;
border-top:40px solid #000; /* soak up negative margin and allows header to start at top of page*/
padding:100px 0 0;/*make room for 100px high banner*/
}
#footer {/* footer now sits at bottom of window*/
background:red;
width:930px;
margin:auto;
height:40px;/* must match negative margin of #outer */
clear:both;
}
/*Opera Fix*/
body:before {/* thanks to Maleika (Kohoutec)*/
content:"";
height:100%;
float:left;
width:0;
margin-top:-32767px;/* thank you Erik J - negate effect of float*/
}
h1, h2, p { padding:0 10px; }
#outer:after {/* thank you Erik J - instead of using display table for ie8*/
clear:both;
display:block;
height:1%;
content:" ";
}
#banner {
position:absolute;
top:40px;
left:0;
height:90px;
width:920px;
background:green;
border:5px solid blue;
text-align:center;
}
</style>
</head>
<body>
<div id="outer">
<div id="header">
<h1>Sticky Footer</h1>
</div>
<h2>Ultimate Sticky footer that works in ie5/6/7/8, Opera 9 and 10, Firefox 2+, Chrome, Safari 3+ (and <a href="http://www.browsercam.com/public.aspx?proj_id=490004">probably every other modern browser</a>)</h2>
<p>test</p>
<p style="clear:both">Element with clear:both added just for testing</p>
<p>test</p>
<p>test</p>
<div id="banner">This will appear at the top of the page</div>
</div>
<div id="footer">
<p>© All rights reserved</p>
</div>
</body>
</html>
The Banner element html is placed on the inside bottom of the wrapper and then moved with css to the top of the page. The space is held open by some padding on the header element otherwise it would overlap.
If you want a fluid height header then you will need the technique shown in the quiz I linked to above which is pretty straight forward and explained in the quiz.
Bookmarks