gpt4 book ai didi

css - Bootstrap 4 Carousel 列而不是 carousel-item

转载 作者:行者123 更新时间:2023-12-04 11:08:17 26 4
gpt4 key购买 nike

Bootstrap 是否支持在 Carousel 中显示网格列或行而不是 carousel-item -s?这个想法是有一个复杂的网格列结构,它们可以像轮播元素一样相互交换。例如,如果我们有以下网格:

<div class="container">
<div class="row" id="row1">
<div class="col col-6-sm">
<!-- further hierarchy -->
</div>
<div class="col col-6-sm">
<!-- further hierarchy -->
</div>
</div>
<div class="row" id="row2">
<div class="col col-6-sm">
<!-- further hierarchy -->
</div>
<div class="col col-6-sm">
<!-- further hierarchy -->
</div>
</div>
<div class="row" id="row3">
<div class="col col-6-sm">
<!-- further hierarchy -->
</div>
<div class="col col-6-sm">
<!-- further hierarchy -->
</div>
</div>
</div>

我希望能够将 row1、row2 和 row3 div 表示为轮播元素。
或者如果 carousel-item 支持在其容器中嵌套网格元素,我可以简单地将网格层次结构包装在 carousel-item 中?

最佳答案

Bootstrap 4 轮播仍然需要 carousel-item类工作,但可以调整它与网格列一起工作。只需在每个 carousel-item 中包含 row>col ...

https://www.codeply.com/go/ojz5BDpOej

     <div id="myCarousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<div class="carousel-item py-5 active">
<div class="row">
<div class="col-sm-6">slide 1</div>
<div class="col-sm-6">slide 2</div>
</div>
</div>
<div class="carousel-item py-5">
<div class="row">
<div class="col-sm-6">slide 3</div>
<div class="col-sm-6">slide 4</div>
</div>
</div>
<div class="carousel-item py-5">
<div class="row">
<div class="col-sm-6">slide 5</div>
<div class="col-sm-6">slide 6</div>
</div>
</div>
<div class="carousel-item py-5">
<div class="row">
<div class="col-sm-6">slide 7</div>
<div class="col-sm-6">slide 8</div>
</div>
</div>
</div>
<a class="carousel-control-prev" href="#myCarousel" 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="#myCarousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>

关于css - Bootstrap 4 Carousel 列而不是 carousel-item,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48648916/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com