html - 对齐到 flexbox 中的底部

标签 html css flexbox

我的容器应该根据内容动态改变高度。对于给定行中的所有容器,无论每个容器中的内容如何,​​底部文本都应固定在底部。

.flex-list {
  display: flex;
  flex-direction: column;
}
.flex-list .flex-row {
  display: flex;
  margin-bottom: 20px;
}
.flex-list .flex-row .flex-item-wrapper {
  margin-right: 20px;
  width: 100%;
  background-color: yellow;
}
.flex-list .flex-row .flex-item-wrapper:last-child {
  margin-right: 0px;
  background-color: transparent;
}
.flex-list .flex-row .flex-item-wrapper .flex-item {
  width: 100%;
  height: 100%;
}
.flex-item-stats {
  display: flex;
  justify-content: space-between;
  color: grey;
  padding-top: 10px;
}
.flex-item-stats > * {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.caption {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
<div class="profile-content flex-list">
  <div class="flex-row">
    <div class="flex-item-wrapper">
      <div class="flex-item thumbnail clickable" data-href="#">
        <img class="img-circle" src="http://blog.blogcatalog.com/wp-content/uploads/mario-300x300.jpg" style="width:150px">
        <div class="caption">
          <h4>
                <a href="#">Y-find</a>
              </h4>
          <div class="flex-item-stats">
            <small>left</small>
            <small>right</small>
          </div>
        </div>
      </div>
    </div>
    <div class="flex-item-wrapper">
      <div class="flex-item thumbnail clickable" data-href="#">
        <img class="img-circle" src="http://blog.blogcatalog.com/wp-content/uploads/mario-300x300.jpg" style="width:150px">
        <div class="caption">
          <h4>
                <a href="#">Cardguard Namfix</a>
              </h4>
          <div class="flex-item-stats">
            <small>left</small>
            <small>right</small>
          </div>
        </div>
      </div>
    </div>
    <div class="flex-item-wrapper">
      <div class="flex-item thumbnail clickable" data-href="#">
        <img class="img-circle" src="http://blog.blogcatalog.com/wp-content/uploads/mario-300x300.jpg" style="width:150px">
        <div class="caption">
          <h4>
                <a href="#">Voyatouch Voyatouch Voyatouch Voyatouch Voyatouch Voyatouch </a>
              </h4>
          <div class="flex-item-stats">
            <small>left</small>
            <small>right</small>
          </div>
        </div>
      </div>
    </div>
    <div class="flex-item-wrapper">
    </div>
  </div>

</div>

我认为在 .caption 上使用 display:flex 以及 space-between 可以推送 flex-item-stats 到底部,但它似乎没有做任何事情。

jsfiddle

最佳答案

关于html - 对齐到 flexbox 中的底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38639889/

相关文章:

css - 用 flexbox 叠加

html - flexbox 表格中的水平和垂直对齐

ruby-on-rails - 使用 css 更改 rails 中字段的外观

html - 将元素放在外面但与元素对齐

CSS 关键帧 : How to move div to certain position

html - 将 div 的内容推到右边

javascript - 用不同的延迟淡化两个图像

html - 元素相对于文本输入的位置

javascript - 用jquery替换另一个div中的div id和文本

css - 如何在不使用绝对位置的情况下将div对齐到右下角?