Is there a way to dynamically adjust the height of the footer based on the content length inside the body?
I've been exploring solutions like setting the position of the footer as "fixed," but it seems to stay at the bottom of the screen, which is not what I want. Ideally, I would like the footer to appear when the user reaches the bottom of the page and automatically adjust its height as the height of the main_content changes dynamically. The main_content's height property is set to auto. How can I achieve this?
To see how it currently appears, click here: http://jsfiddle.net/cherry12345/t62b2qb6/
Here's the code:
HTML
<body>
<div id="main_content">
<p>Some text</p>
....(content truncated for brevity)...
<p>Some text</p>
</div>
<div id="footer">
© 2014-2015 example.com. All Rights Reserved.
</div>
</body>
CSS
#main_content {
width: auto;
height:auto;
position:absolute;
top:110px;
left:400px;
background: #FFF;
border:1px solid lightgray;
}
#footer{
position:absolute;
bottom:0px;
width:100%;
background: #666;
padding: 24px;
font-size: 12px;
color: #CCC;
text-align: center;
}