admin管理员组文章数量:1328893
I am trying to make a carousel on a home page, but images doesn't fit to 100% of the page width, and it doesn't get responsive:
<div id="mainCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#mainCarousel" data-slide-to="0" class="active"></li>
<li data-target="#mainCarousel" data-slide-to="1"></li>
<li data-target="#mainCarousel" data-slide-to="2"></li>
<li data-target="#mainCarousel" data-slide-to="3"></li>
</ol>
<!-- slides image -->
<?php
$slides = array(
"slide0" => "23",
"slide1" => "26",
"slide2" => "28",
"slide3" => "27");
?>
<div class="carousel-inner">
<?php foreach($slides as $key => $slide) { ?>
<div class="carousel-item <?php if($key == "slide0"){echo 'active';} ?>">
<img class="slide-img" src="<?php
echo wp_get_attachment_image_url($slide);
?>" alt="<?php echo $key; ?>">
</div>
<?php } ?>
</div>
<!-- Controls -->
<a class="carousel-control-prev" href="#mainCarousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#mainCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
I tried with this CSS Code:
.carousel .carousel-item img.slide-img{
max-width: 100%;
height: auto;
}
the same code i have in another simple web page -not a wordpress project- it works fine (see image bellow), is there any problem with carousels on wordpress ? Thanks
本文标签: bootstrap carousel in wordpress home page showing small images and not responsive
版权声明:本文标题:bootstrap carousel in wordpress home page showing small images and not responsive 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742262727a2442817.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论