I'm attempting to create a numbered list where each li
element contains an image and a text block. The list-number, image and text block should all be vertically aligned along a horizontal center-line. The text block could be multiple lines. Here's a very rough illustration:
The closest I've achieved is the following, which aligns the list-number at the bottom (tested in Chrome 15, Firefox 8, IE9). See also jsfiddle mockup.
<style type="text/css">
li div { display: inline-block }
li div div { display: table-cell; vertical-align: middle }
</style>
<ol>
<li><div><div><img src=widget.png></div><div>Caption Text Here</div></div></li>
</ol>
Is there a cross-platform way of doing this without supplying the numbering myself?
Edit. One more requirement: if the container-width is very small (e.g., when viewed on a mobile device), then the text-block must stay to the right of the image. There should be no text-wraping around the image.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…