I'm looking for a solution to have a sticky footer which height may be dependent on the width of the browser.
Sticky footers in fluid designs are not all that trivial. I've found hints, discussions and solutions to implement sticky footers. However, all these are dependent on a fixed and known height of the footer. In my case, the height of the footer contains text and the number of lines is dependent on the width of the screen.
Rather than making al sorts of media queries and building some work aorund, I'm would prefer a clean CSS solution in which the sticky footer auto adapts when the width of the screen varies.
Does anyone of you have the ultimate answer?
Try something like this:
http://jsfiddle.net/6BQWE/2/
Where the height of the sticky footer is relative to the height of the container, with a percentage:
You may need to sort out some margin/padding for the text with media queries but the footer dimensions will be dynamic without them.
Welcome to the magical world of flexbox! Try this out... http://jsfiddle.net/n5BaR/
The paddings and margins are just to be a little pretty, but the magic happens with
display: flex; min-height: 100vh; flex-direction: column;
andflex: 1;
.For more information and other examples, see http://philipwalton.github.io/solved-by-flexbox/demos/sticky-footer/
From Mozilla...