I have a page that already has a footer permanently “bottom-aligned” using a container with 100% height and the following css:
#footer {
position: absolute;
left: 0px;
right: 0px;
bottom: 0px;
font-size: 12px;
}
What I would like to do is have the buttons for my page’s form (denoted in the html below by the div with class “actionButtons”) always directly above the footer, regardless of the other content of the form. I can guarantee that the form’s content will never cause overflow.
<html>
<body>
<div>
<div class="wideContent">
<form>
<div class="actionButtons" style="text-align:right;">
</div>
</form>
</div>
</div>
<div id="footer"></div>
</body>
</html>
I’ve been messing with height/min-height with no success. What css would I need for the html above to always place the “actionButtons” div at the bottom of the window, just above the footer? Thank you in advance.
Since the
<form>hasposition:relativethe only way I can think of forcing the buttons to the bottom isposition:fixed, for example……as in this demo. But it will require a height being set on the
#footerwhich matches thebottomon the.actionButtonsto place it correctly. (I have included aheighton the.actionButtonsfor demo purposes).