- This topic is empty.
-
AuthorPosts
-
June 3, 2014 at 1:05 pm #171696wafflParticipant
I am trying to vertical align a number of different sized images in Zurb Foundation using the block grid.
I have setup this jsfiddle – http://jsfiddle.net/waffl/cLc2v/1/ – and have tried setting the parent container of the li to
relative
and theli
s themselves toposition: absolute; bottom: 0;
which seems to be causing the parent to collapse and thus, display the item way too high.So amazed that vertical alignment is still an issue that perplexes me so much.
June 3, 2014 at 2:40 pm #171706AtelierbramParticipantIn the near future vertical alignment will be easier to accomplish with flexbox.
June 4, 2014 at 1:20 am #171746AtelierbramParticipant@waffl Best go with the
display: inline-block
solution for now. Using Zurb’s block-grid classes (you can, maybe even better, also choose not to, and make your own classes) theCSS
would be something like this:ul.small-block-grid-4 li { float: none; display: inline-block; } img { vertical-align: baseline; width: 100%; max-width: 100%; }
Note from @wolfcry911 ‘s demo, in the HTML tab, how the closing and opening list-item brackets are ‘touching‘
</li><li>
. This is for removing white-space to prevent the rounding errors that come withdisplay: inline-block
in some browsers.June 4, 2014 at 1:22 pm #171852wafflParticipant@Atelierbram – You are my hero!!! Amazing, works perfectly, and yes thank you for highlighting the whitespace issue, that is indeed a problem without a very elegant solution as of yet unfortunately.
Thank you so much for the help, this worked perfectly.
October 3, 2014 at 7:16 am #185350realphParticipant@waffl @Atelierbram I also ran into this problem and am using the
display: inline-block
solution, which aligns every image to the bottom. But for some reason, the last item in the row doesn’t show.So, for example a
small-block-grid-4
shows only 3 items in a row, rather than 4.October 3, 2014 at 7:20 am #185351wafflParticipant@realph did you double check the issues mentioned about whitespace causing the next item to push down due to rounding errors with ‘inline-block’?
October 3, 2014 at 8:02 am #185354 -
AuthorPosts
- The forum ‘CSS’ is closed to new topics and replies.