【问题标题】:bootstraps 3 align bottom with 3 column in rowbootstrap 3将底部与行中的3列对齐
【发布时间】:2015-11-13 22:25:45
【问题描述】:

我见过这个线程,但它是 2 列 (col-md-6),我也尝试了 jsfidlle 3 列,但第 1 列和第 2 列变成堆栈。

Bootstrap 3 Align Text To Bottom of Div

我想要的项目是

.row {
      position: relative;
  }

 .bottom-align-text {
    position: absolute;
    bottom: 0;
    right: 0;
  }
<div class="container">
    <div class="row">
        <div class="bottom-align-text col-sm-4">
            <h3>Some Text</h3>
        </div>
        <div class="col-sm-4">
            <img src="//placehold.it/600x300" alt="Logo" class="img-responsive"/>
        </div>
        <div class="bottom-align-text col-sm-4">
            <h3>Some Text</h3>
        </div>
    </div>
</div>

如何让它们都对齐底部?

【问题讨论】:

  • 你必须增加或减少bottomright的值
  • 尝试包括vertical-align:bottom;在你的 CSS 中??

标签: css twitter-bootstrap alignment


【解决方案1】:

flexbox 可以做到这一点

.row div {
  border: 1px solid red;
}

.flexy {
  display: flex;
  text-align: center;
}

.flexy .bottom-align-text {
  display: flex;
  justify-content: center;
  align-items: flex-end;

}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
  <div class="row flexy">
    <div class="bottom-align-text col-sm-4">
      <h3>Some Text</h3>
    </div>
    <div class="col-sm-4">
      <img src="//placehold.it/600x300" alt="Logo" class="img-responsive" />
    </div>
    <div class="bottom-align-text col-sm-4">
      <h3>Some Text</h3>
    </div>
  </div>
</div>

【讨论】:

    【解决方案2】:

    您可以将 column 1stcolumn 2nd 包装到 row 中,然后我们将有 2 列结构。查看我的 jsFiddle 演示:https://jsfiddle.net/robinhuy/kg1ykfL1/3/

    【讨论】:

    • 欢迎来到 Stack Overflow!虽然这在理论上可以回答这个问题,it would be preferable 在此处包含答案的基本部分,并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能会失效
    猜你喜欢
    • 1970-01-01
    • 2014-05-08
    • 2017-01-19
    • 1970-01-01
    • 2014-08-23
    • 2019-07-03
    • 2014-12-03
    • 1970-01-01
    • 2018-05-23
    相关资源
    最近更新 更多