php – Center horizontall images dinamically with Bootstrap


I have a mysqli_fetch_assoc that return me images. I need put all of these images centered horizontally. I try use center-block on all of this, but only center one and the others images goes down.

For example:

If mysql give me 2 images:

<body>

<div class="col-xs-12">

<img src="http://osolephp.com.es/grafa/imagenes/imagenesropa/cocinas_6.png?30" class="center-block">
<img src="http://osolephp.com.es/grafa/imagenes/imagenesropa/cocinas_6.png?30" class="center-block">

</div>
</body>

https://jsfiddle.net/ff4rj8zs/

If mysql give me 3 images:

<body>

<div class="col-xs-12">

<img src="http://osolephp.com.es/grafa/imagenes/imagenesropa/cocinas_6.png?30" class="center-block">
<img src="http://osolephp.com.es/grafa/imagenes/imagenesropa/cocinas_6.png?30" class="center-block">
<img src="http://osolephp.com.es/grafa/imagenes/imagenesropa/cocinas_6.png?30" class="center-block">

</div>
</body>

https://jsfiddle.net/96czjmoh/

As you can see, the images goes down, and don’t stay in the same line. I need that all images stay centered in the same line independent of the quantity.

Thanks!



لینک منبع

پاسخ دهید

نشانی ایمیل شما منتشر نخواهد شد. بخش‌های موردنیاز علامت‌گذاری شده‌اند *