【问题标题】:How to align image on left in a bootstrap carousel如何在引导轮播中对齐左侧图像
【发布时间】:2021-12-12 12:32:27
【问题描述】:

我需要在我的引导轮播中将我的图像在左侧对齐。

实际上每个图像都是中心位置。

<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>

【问题讨论】:

    标签: css wordpress bootstrap-4


    【解决方案1】:

    您需要从.carousel-item 元素中的图像中移除 100% 的宽度。

    类似这样的:

    .carousel-item img {width: auto;}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-15
      • 2015-12-07
      • 1970-01-01
      • 2014-07-21
      • 2015-11-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多