【发布时间】:2017-07-14 01:04:46
【问题描述】:
引导程序 4 阿尔法 6
看这里https://v4-alpha.getbootstrap.com/layout/grid/#vertical-alignment
我也发现了这个:
https://v4-alpha.getbootstrap.com/utilities/flexbox/#direction
但到目前为止还没有运气
我尝试:
将元素对齐到行的顶部和行的底部
它不需要在同一行。但我认为这是最简单的。由于每一行都是一个新的 flex 容器,我认为它的工作方式没有什么不同。
查看此代码笔 https://codepen.io/anon/pen/GEzBrw
@import url( 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css' );
html,
body {
height: 100%;
}
.container {
min-height: 100%;
height: auto;
background-color: gray;
}
.my-top {
background-color: salmon;
}
.my-bot {
background-color: cornflowerblue;
}
<div class="container">
<div class="row justify-content-between">
<div class="col my-top">
<p>Red container to the top (works)</p>
<p>Red container to the top (works)</p>
<p>Red container to the top (works)</p>
<p>Red container to the top (works)</p>
<p>Red container to the top (works)</p>
<p>Red container to the top (works)</p>
</div>
<div class="w-100"></div>
<div class="col my-bot align-self-end">
<p>Blue container to the bottom (doesn't work)</p>
<p>Blue container to the bottom (doesn't work)</p>
<p>Blue container to the bottom (doesn't work)</p>
<p>Blue container to the bottom (doesn't work)</p>
grey stuff in between. no hard coding with padding or such allowed
</div>
</div>
</div>
编辑
想要的输出
【问题讨论】:
-
试图将元素对齐到底部的代码在哪里?到目前为止,代码仅突出显示元素。
-
这个想法是
justify-content-between在元素之间添加空间。是的,但是很好的问题,在 bootstrap 4 文档中尝试将元素对齐到底部的代码在哪里? -
我的意思是我尝试了他们页面上的所有内容,但没有任何效果。我也可以放弃这些尝试。
-
Toskan,我在问你你的代码在哪里试图对齐底部的元素。
-
没必要生气。 v4-alpha.getbootstrap.com/layout/grid/#vertical-alignment 我正在尝试使用 bootstrap 4 类将元素与底部对齐。分别证明元素之间的内容
标签: html css twitter-bootstrap flexbox bootstrap-4