Home > Software engineering >  How to align image on left in a bootstrap carousel
How to align image on left in a bootstrap carousel

Time:10-27

i need to align my images on left in my bootstrap carousel.

Actually each image is center position.

<div id="testslider" class="carousel slide" data-ride="carousel" data-interval="false">
<div class="carousel-inner">
<?php if ( have_rows( 'galerie_de_photo' ) ) : ?>
<?php $count = 0; while ( have_rows('galerie_de_photo') ) : the_row(); ?>
<div class="carousel-item <?php if ($count == 0) { ?>active<?php } ?>">
<?php $visuel = get_sub_field( 'visuel' ); ?>
<?php if ( $visuel ) { ?>
<img src="<?php echo $visuel['url']; ?>" alt="<?php the_field( 'texte_alternatif' ); ?>" />
<?php } ?>
</div>
<?php 
$count  ; 
endwhile; ?>
<?php endif; ?>
</div>
</div>

CodePudding user response:

You need to remove the 100% width from the image in the .carousel-item element.

Something like this:

.carousel-item img {width: auto;}
  • Related