html - Center horizontall images dinamically with Bootstrap -


i have mysqli_fetch_assoc return me images. need put of these images centered horizontally. try use center-block on of this, center 1 , 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 can see, images goes down, , don't stay in same line. need images stay centered in same line independent of quantity.

thanks!

use this:

<body>  <div class="col-xs-12 text-center">  <img src="http://osolephp.com.es/grafa/imagenes/imagenesropa/cocinas_6.png?30"> <img src="http://osolephp.com.es/grafa/imagenes/imagenesropa/cocinas_6.png?30"> <img src="http://osolephp.com.es/grafa/imagenes/imagenesropa/cocinas_6.png?30">  </div> </body> 

see: https://jsfiddle.net/ff4rj8zs/3/


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -