twitter-bootstrap 如何在 Bootstrap 4 col 上对齐内容底部

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43933157/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 00:50:22  来源:igfitidea点击:

How to align content bottom on Bootstrap 4 col

twitter-bootstrapflexboxbootstrap-4twitter-bootstrap-4

提问by AAndrei

I have the following code for a footer:

我有以下页脚代码:

  <div class="container"> <hr>
    <div class="row">
      <div class="col-md-6"> 
         ? BusinessName 2017.
      </div>
      <div class="col-md-3"> <br>
        <a href="/blog"> Blog </a> <br>
        <a href="/blog"> FAQ </a> <br>
        <a href="/blog"> About </a> 
      </div>
      <div class="col-md-3"> 
        <p><strong>Contact</strong> <br> [email protected] <br> more info bla bla <br> more more more info</p>
      </div>
    </div>   </div>

I am trying to align all content on bottom line, I've tried some things but nothing works... any bright ideas?

我试图将所有内容放在底线上,我尝试了一些东西,但没有任何效果……有什么好主意吗?

回答by Zim

You can use align-items-endfrom the new Bootstrap 4 flexbox utilities...

您可以使用align-items-end来自新的引导4 Flexbox的事业......

<div class="container">
    <hr>
    <div class="row align-items-end">
        <div class="col-md-6">
            ? BusinessName 2017.
        </div>
        <div class="col-md-3">
            <a href="/blog"> Blog </a>
            <br>
            <a href="/blog"> FAQ </a>
            <br>
            <a href="/blog"> About </a>
        </div>
        <div class="col-md-3">
            <strong>Contact</strong>
            <br> [email protected]
            <br> more info bla bla
            <br> more more more info
        </div>
    </div>
</div>

http://codeply.com/go/GXTF43toS9

http://codeply.com/go/GXTF43toS9

Also, auto margins work inside flexbox. There you could use mt-auto(margin-top:auto) to "push" the col-* to the bottom.

此外,自动边距在 flexbox 内有效。在那里您可以使用mt-auto(margin-top:auto) 将 col-*“推”到底部。

回答by Julesezaar

Row vs col, check it out https://jsfiddle.net/Julesezaar/zyh5a4rb/

Row vs col,看看https://jsfiddle.net/Julesezaar/zyh5a4rb/

For all the columns in the entire row use align-items-endon the row

对于整个行使用的所有列align-items-end上的行

<div class="row border align-items-end">
    <div class="col"> 
        A (row align-items-end)
        <br/>
        A<br/>
        A<br/>
    </div>
    <div class="col">
        B
    </div>
    <div class="col">
        C
    </div>
    <div class="col">
        D
    </div>
</div>

For a single column us align-self-end

对于单列我们 align-self-end

<div class="row border">
    <div class="col"> 
        A
    </div>
    <div class="col">
        B<br/>
        B<br/>
        B<br/>
    </div>
    <div class="col align-self-end">
        C (col align-self-end)
    </div>
    <div class="col">
        D
    </div>
</div>