css sticky footer without scrolbar
Posted
by massinissa
on Stack Overflow
See other posts from Stack Overflow
or by massinissa
Published on 2010-02-02T15:54:55Z
Indexed on
2010/03/22
1:11 UTC
Read the original article
Hit count: 509
How to do to avoid having the scroller with a sticky footer to the bottom of the page (not bottom of window)? When I remove height=100% from content and sidebar, I'm no more getting the scroller. However, when doing so, my content and sidebar do not fill all the space down to the footer.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 13</title>
<style media="all" type="text/css">
* {
margin: 0;
padding: 0;
}
html, body, #wrap, form {
height: 100%;
}
#wrap, #footer {
width: 750px;
margin: 0 auto;
}
#wrap {
background: #cff;
}
html, body {
color: #000;
background: #a7a09a;
}
body > #wrap {
height: 100%;
min-height: 100%;
}
form {
/*height: auto;*/
min-height: 100%;
}
#main {
background: #000;
height:100%;
min-height:100%;
height: auto !important; */
}
#content {
height:100%;
float: left;
padding: 10px;
float: left;
width: 570px;
background: #9c9;
}
#sidebar {
height:100%;
float: left;
width: 140px;
background: #c99;
padding: 10px;
}
#footer {
position: relative;
margin-top: -100px;
height: 100px;
clear: both;
background: #cc9;
bottom: 0;
}
.clearfix:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
.clearfix {
display: inline-block;
}
* html .clearfix {
height: 1%;
}
.clearfix {
display: block;
}
#header {
/*padding: 5px 10px;*/
background: #ddd;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div id="wrap">
<div id="main" class="clearfix">
<div id="header">
<h1>header</h1>
</div>
<div id="sidebar">
<h2>sidebar</h2>
</div>
<div id="content">
<h2>main content</h2>
</div>
</div>
</div>
<div id="footer">
<h2>footer</h2>
</div>
</form>
</body>
</html>
© Stack Overflow or respective owner