如何在 bootstrap 旋转木马中对齐左侧图像
How to align image on left in a bootstrap carousel
我需要在我的 bootstrap 旋转木马中将我的图像左对齐。
其实每张图都是中心位置
<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>
您需要删除 .carousel-item
元素中图像的 100% 宽度。
像这样:
.carousel-item img {width: auto;}
我需要在我的 bootstrap 旋转木马中将我的图像左对齐。
其实每张图都是中心位置
<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>
您需要删除 .carousel-item
元素中图像的 100% 宽度。
像这样:
.carousel-item img {width: auto;}