Reputation: 2557
Hello I trying to create sticky footer as described in this beatiful article. But I getting scroll bar on browser, and my footer "slides" out of screen borders. Here is my code:
Html:
<div id="page">
<div id="header">
<div id="main_menu">
</div>
</div>
<div id="content">
fdsfsdfsdfsd
<div id="push"></div>
</div>
<div id="footer"></div>
</div>
CSS:
html, body {
height: 100%;
}
#content {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -28px;
}
#push, #footer {
height: 28px;
clear: both;
}
Can somebody help me? What I am doing wrong?
Upvotes: 0
Views: 40
Reputation: 15070
You should use a wrapper instead of targetting #content
.
html, body, #page {
height: 100%;
margin: 0;
padding: 0;
}
#wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -28px;
}
#push, #footer {
height: 28px;
clear: both;
}
#footer {
background-color: green;
}
<div id="page">
<div id="wrapper">
<div id="header">
<div id="main_menu"></div>
</div>
<div id="content">fdsfsdfsdfsd</div>
<div id="push"></div>
</div>
<div id="footer"></div>
</div>
Upvotes: 1
Reputation: 17952
You'll have some extra margin/padding on the page.. try
html, body {
margin: 0;
padding: 0;
}
Upvotes: 0