Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to align content bottom on Bootstrap 4 col

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?

like image 288
AAndrei Avatar asked May 12 '17 08:05

AAndrei


People also ask

How do I align content to the bottom of a div?

To align the div content to the bottom, use position: relative to the container class and position: absolute to the div element.


2 Answers

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

<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

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

like image 122
Zim Avatar answered Oct 02 '22 08:10

Zim


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

For all the columns in the entire row use align-items-end on the row

<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 on the col

<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>
like image 28
Julesezaar Avatar answered Oct 02 '22 08:10

Julesezaar