html - Bootstrap 4 轮播 - 文本左/图像右

标签 html css bootstrap-4

我试图弄清楚这种设计是否可以用于 Bootstrap 4 轮播。

enter image description here

本质上,我想要制作一个像上图所示的 slider ,但我不知道是否可以将文本放在左侧,将图像放在带有箭头的右侧。

这可能吗?

非常感谢任何帮助。

我目前只有默认的 Bootstrap 4 轮播代码。

<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img class="d-block w-100" src="..." alt="First slide">
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="..." alt="Second slide">
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="..." alt="Third slide">
    </div>
  </div>
  <a class="carousel-control-prev" href="#carouselExampleIndicators" 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="#carouselExampleIndicators" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

最佳答案

使用 Bootstrap 网格。例如 2 列...

      <div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
             <div class="carousel-inner">
                    <div class="carousel-item active">
                        <div class="row align-items-center">
                            <div class="col-md py-2">
                                <p> Text text text here. Text here, here, here, here is the text. Text here, here, here, here is the text. </p>
                                <button class="btn btn-primary">More here</button>
                            </div>
                            <div class="col-md py-2">
                                <img class="d-block img-fluid" src="..." alt="First slide">
                            </div>
                        </div>
                    </div>
                    <div class="carousel-item">
                        ...
                    </div>
                    <div class="carousel-item">
                        ...
                    </div>
             </div>
      </div>

Codeply demo

关于html - Bootstrap 4 轮播 - 文本左/图像右,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62572072/

相关文章:

javascript - 找到:selected element from list using JQuery

html - 为什么父项的悬停状态不会改变子项的行高,即使是 "!important"?

javascript - 类似灯箱的叠加效果,可在单击时显示隐藏的 DIV

html - 同一页面上的默认轮播和多元素轮播

html - 如何使我的 html 中的图像大小相等?

html - 如何在终端中解析html文本文件?

javascript - 返回顶部按钮未正确触发

javascript - 使关键帧在单击时重新启动

Html 和 CSS 中的 Javascript 冲突

javascript - 在 Angular 5 中将 html 传递给 viewChild