One common challenge is how to position content at the bottom of a div
, but with Flexbox, it's becoming easier nowadays.
In my case, I'm using the Zurb Foundation grid with equalisation. This equalisation is crucial because my cell
s have an image (fixed height) and a caption of variable length. The caption consists of a title (directly under the image) and a subtitle that I want to be at the bottom of the image card.
If you want to see what I'm dealing with, here's a Codepen link: https://codepen.io/arokat/pen/ZEbzOMp
I've experimented with different suggestions like flexbox, applying height: 100%
to .image-card-caption__title
, etc. However, I can't seem to get the subtitle to stay at the bottom while maintaining the desired appearance. (Absolute positioning + bottom: 0
messes up the layout...)
The issue might be that the div's height isn't set until after the JS equalisation code runs, causing CSS rules to apply at the wrong time.
I'd prefer not to fix the height of the .image-card-caption
div since both the title and subtitle could vary significantly in length.
Any suggestions? Thank you in advance :)
Current Layout: https://i.sstatic.net/5ABBP.jpg
Desired Layout:
(approximated - alignment isn't perfect, just used <br />
tags for representation)
https://i.sstatic.net/eTEQl.jpg