In my code below, I have 3 images with a caption below some images. I don't want the width of the text to exceed the width of the image. NOTE: the width of the images can vary. It is not a fixed width. If the text exceeds the width of the image, the text needs to wrap. Another problem I have in the code below is that the second and third images show some padding at the bottom of the image. The border around this image should have no padding.
http://jsfiddle.net/AndroidDev/Asu7V/15/
<div style="width:300px; overflow-x: auto;white-space: nowrap;">
<div style="vertical-align:top">
<div class="x">
<img src="http://25.media.tumblr.com/avatar_dae559818d30_128.png" />
<div style="white-space:wrap">Grumpy Cat is a famous cat</div>
</div>
<div class="x">
<img src="http://scottsdalepethotel.com/wp-content/uploads/et_temp/cat-648150_128x128.jpg" />
<img src="http://playgo.ro/wp-content/themes/play3.0/play.png" style="position:absolute; left:0; top:0" />
</div>
<div class="x">
<img src="http://blog.sureflap.com/wp-content/uploads/2011/11/Maru.jpg" />
</div>
</div>
</div>