[英]Bootstrap Flexbox align div to bottom of div stops other divs from aligning
I'm trying to align a div to sit at the bottom of the parent div using flex box. 我正在尝试使用弹性框将div对齐以使其位于父div的底部。 I want the
footer-bottom
to be aligned at the bottom of each card. 我希望
footer-bottom
底部在每张卡的底部对齐。 I've tried using align-self: end;
我试过使用
align-self: end;
which works but this stops the titles from aligning. 可以,但是这会阻止标题对齐。 See js fiddle
见js小提琴
I'm aware bootstrap 4 has a way of doing this by using the default card syntax but i need to include columns within each card for when it goes down to mobiles. 我知道bootstrap 4通过使用默认的卡语法可以做到这一点,但是我需要在每张卡中都包含列,以了解何时下降到手机上。
Can anyone help me please? 谁能帮我吗?
<div class="mb-4 col-lg-4 normal-article">
<article class="card">
<div class="row no-gutters">
<div class="col-md-3 col-lg-12 order-12 order-md-1">
<div class="mobile-display">
<div class="card-img-top thumbnail" style="background-image:url('http://skeleton-theme.local/wp-content/uploads/2017/09/ukmr-_0022_talk-of-the-town-318x179.jpg')">
</div>
<div class="d-md-none">
<p>Social shifts over the last decade have increased the pressure to live in well connected centres of population. </p>
</div>
</div>
</div>
<div class="order-1 order-md-12 col-md-9 col-lg-12">
<div class="card-body">
<div class="entry-meta">
<span class="cat-links"> <a href="http://skeleton-theme.local/category/south-east/" rel="category tag">South East</a></span><span class="d-none edit-link"><a class="post-edit-link" href="http://skeleton-theme.local/wp-admin/post.php?post=3433&action=edit">Edit <span class="screen-reader-text">"Talk of the Town"</span></a></span> </div>
<header class="entry-header">
<h2 class="entry-title"><a href="http://skeleton-theme.local/talk-of-the-town/" rel="bookmark">Talk of the Town</a></h2>
</header><!-- .entry-header -->
</div><!-- .card-body -->
</div>
<div class="order-12 col-12 footer-bottom">
<div class="card-footer">
<small class="text-muted"><span class="posted-on">Posted on <a href="http://skeleton-theme.local/talk-of-the-town/" rel="bookmark"><time class="entry-date published" datetime="2017-09-14T15:00:44+00:00">14/09/2017</time></a></span></small>
</div>
</div>
</div>
</article>
</div>
okay here is how i'd fix this. 好的,这是我要解决的方法。
flex-direction: column;
flex-direction: column;
to your .no-gutters
css rule .no-gutters
CSS规则 no-gutters
div has 3 children. no-gutters
div有3个孩子。 on the first and second child, add flex: 1;
flex: 1;
or whatever values based on the ration you want to give the two divs, and on the third child (footer-bottom) add flex: 0 auto;
flex: 0 auto;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.