【问题标题】:Bootstrap 4.1 carousel item title and textBootstrap 4.1 轮播项目标题和文本
【发布时间】:2018-10-02 05:25:45
【问题描述】:

我正在使用最新版本的 Bootsrap

我想给 carousel-item 添加标题和文本。

但是p代码,留在同一行,

它应该在h5代码之后。

这是我的一些代码:

https://www.codeply.com/go/3qfv388vII

【问题讨论】:

    标签: twitter-bootstrap bootstrap-4


    【解决方案1】:

    看起来是 d-flex 类引起的。 如果你改变这个:

    <div class="d-flex h-100 align-items-center justify-content-center">
    

    到这里:

    <div class="custom-flex h-100 align-items-center justify-content-center">
    

    并将其添加到您的样式表中:

    .custom-flex {
      display: flex;
      flex-direction: column;
    }
    

    你会得到想要的结果。

    编辑

    要仅使用引导类,您可以添加 flex-column 类,如下所示:

    <div class="d-flex flex-column h-100 align-items-center justify-content-center">
    

    【讨论】:

    • 是的,它正在工作。但我认为没有这个有最好的解决方案,有引导程序
    • 那么您可以改为从引导程序添加 flex-column 类,将更新我的答案
    • class="d-flex flex-column" 与没有引导的编写 style="display:flex; flex-direction:column" 相同
    猜你喜欢
    • 2019-02-28
    • 2016-02-14
    • 1970-01-01
    • 2019-11-19
    • 2022-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-21
    相关资源
    最近更新 更多