If I have a HTML page like this:
<!DOCTYPE html>
<html>
<body>
... some content or other ...
<footer>... some footer text</footer>
</body>
</html>
And I want the <footer>
element to stick to the very bottom of the page (not the viewport, the page), even if there is not enough content to fill the page, and even if the height of the footer is unknown.
Solutions I am aware of but don't fulfill criteria:
position: fixed; bottom: 0;
– this will stick to the bottom of the viewport, not the pageposition: absolute; bottom: 0;
– this will be at the bottom of the viewport, but will stay in the same place when the user scrolls- Wrapping the content in a container with
min-height: 100%
and then a margin the height of the footer – does not work with a footer of unknown height, plus requires additional mark-up to enable the style - CSS Flexbox – honestly this looks like the most promising but given even as of 2016 the browser support is patchy (support in IE is limited to IE11, and with problems).
So, any modern solutions? I retired from web design about 8 years ago and recently started again, it's mind-boggling to me how many of these basic tasks still seem to require brittle work-arounds based on fixed-size adjustments.