Well, the title says it all. How to vertically center a child element of arbitrary size inside a floated parent element (of known size)?
display: table-cell; vertical-align: middle;
no longer seems to work when the element is floated.
I created an SSCCE here: http://mathiasbynens.be/demo/center-vertically-inside-float
Without float, everything works as it should. But as soon as the parent element is floated, the vertical alignment fails.
Any ideas how to work around this?
Edit: I should’ve added that the child elements are supposed to be images. In my example page I’m using paragraphs, since I assumed I could apply whatever CSS those p
elements needed to img
elements with display: block;
as well. (Fail.)