I am working on a piece of code that includes 3 images with captions below them. I want to ensure that the width of the text does not exceed the width of the image, even though the image widths can vary. If the text extends beyond the image width, it should wrap. Additionally, I noticed an issue where the second and third images have some padding at the bottom, which should not be there.
<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>