We are working on a container that has overflow-y:scroll
and requires a sticky footer (bottom 0) unless the combined height of the content inside the scrolling container and the dynamic height of the footer exceed the container's height.
Here is the HTML structure:
<div class="wrapper">
<div class="scroll">
<div class="content">
Lorem ipsum dolor sit amet
</div>
<div class="footer">
This footer should stick to the bottom until the .content overflows, then it should move below it.
</div>
</div>
</div>
The amount of content in both .content and .footer may vary.
We prefer not to use JavaScript for this solution if possible.
I have created a fiddle with different scenarios here: http://jsfiddle.net/bqvtf1zo/1/
Removing position: absolute
from .footer fixes the issue with "little content" case (refer to the fiddle), but it breaks the other two cases.