【问题标题】:Bootstrap vertical align property not working引导垂直对齐属性不起作用
【发布时间】:2018-11-12 09:38:56
【问题描述】:

Bootstrap 文档中的一个非常基本的问题。到目前为止,一切似乎都奏效了,除了这个垂直对齐。在下图中您可以看到How it should beHow it appears in my browser

   <div class="container">
      <div class="row">
        <div class="col align-self-start">
          One of three columns
        </div>
        <div class="col align-self-center">
          One of three columns
        </div>
        <div class="col align-self-end">
          One of three columns
        </div>
      </div>
   </div>

【问题讨论】:

    标签: twitter-bootstrap bootstrap-4 vertical-alignment


    【解决方案1】:

    垂直中心与高度有关。在您的示例中,所有同级列的高度都相同,因此您不会看到对齐方式有任何变化。

    .row 需要定义高度,列中的某些内容会导致行具有更高的高度。

    <div class="container">
        <div class="row" style="height:180px">
            <div class="col align-self-start">
                One of three columns
            </div>
            <div class="col align-self-center">
                One of three columns
            </div>
            <div class="col align-self-end">
                One of three columns
            </div>
        </div>
    </div>
    

    演示:https://www.codeply.com/go/aCGgDtzhdY

    【讨论】:

    • @user7759474 这行得通吗?请接受答案,以便其他人知道问题已解决
    猜你喜欢
    • 1970-01-01
    • 2017-05-13
    • 2019-11-26
    • 1970-01-01
    • 1970-01-01
    • 2018-02-15
    • 2018-02-01
    • 2017-05-26
    相关资源
    最近更新 更多