I am tried so many ways, no success after searching and working for three days.
Html:
<div id="wrapper">
<div id="header"></div>
<div id="container">
<div id="containertable">
<div id="leftbar"></div>
<div id="contents"></div>
<div id="rightbar"></div>
</div>
</div>
<div id="footer"></div>
</div>
CSS:
<style>
html{
overflow-y: scroll;
}
html,
body {
margin:0 auto;
padding:0;
height:100%;
width: 1024px;
}
#wrapper {
min-height:100%;
position:relative;
background: blueviolet;
}
#header {
background:#ff0;
width: 1024px;
height: 70px;
}
#container {
padding-bottom:60px; /* Height of the footer */
display: table;
}
#containertable{
width: 1024px;
display: table-row;
}
#leftbar, #rightbar{
width: 170px;
height: 100px;
display: table-cell;
background: brown;
}
#contents{
width: 684px;
height: 200px;
display: table-cell;
background: burlywood;
}
#footer {
width: 1024px;
position:absolute;
bottom:0;
width:100%;
height:60px; /* Height of the footer */
background:#6cf;
}
Using the above code and other versions, I am able to get the 1 and 2nd cases, But I am not able to make the columns stay 100% height and equal and push the footer to the bottom of the page.
In the below image, I am looking for the third case at all the situations.
Three different cases of pushing the footer div to the bottom of the page
Martin Turjak gave the solution below and that worked great for me.
Jsfiddle
http://jsfiddle.net/yellowandred/LznnG/5/
HTML:
<div class="wrapper">
<div class="column1"><a href="#">Test</a></div>
<div class="column2">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>
<div class="spacer"></div>
<div class="footer">Footer</div>
</div>
CSS:
html, body {
width:100%;
height:100%;
margin:0;
padding:0;
text-align:center;
}
.wrapper {
position:relative;
min-height:100%;
width:80%;
margin:0 auto;
font-size:0px;
}
.wrapper div {
font-size:16px;
}
.column1, .column2 {
float:left;
margin-bottom:30px;
height:100%;
bottom:0;
}
.column1::before, .column2::before {
position:absolute;
content:'';
top:0;
bottom:0;
background:pink;
right:0;
z-index:-1;
}
.column1::before {
background:green;
left:0;
}
.column2::before {
background:blue;
left:30%;
}
.column1 {
width:30%;
}
.column2 {
width:70%;
}
.spacer {
position:relative;
clear:both;
}
.footer {
position:absolute;
height:30px;
bottom:0;
width:100%;
background:orange;
}