I'm trying to set up a div that contains an image floated to the top left, and text of an unknown length. The goal is to have the text centered in the middle of the div if it's smaller than the image, or wrap around the the image if there's enough of it.
My general layout is:
<div class="wrapper">
<img src="http://placekitten.com/50/50" class="image" style="float: left">
<p class="text">
Text goes here
</p>
</div>
I've tried display table and flexbox, but those treat the image and the text as distinct blocks and prevent long text from wrapping around the image. Fixed height also doesn't work since the text is variable in length and there can be several lines that need to align vertically before it starts wrapping around the image.
I've set up a fiddle with the result I'm trying to get. It uses two different hard-coded styles but I'm trying to find a single solution that will work no matter how much text is supplied.
Is there a way around this without some kind of javascript hack?