18

I need to align a box to the left bottom of the bootstrap column. Thank you for help.

How I need it

The problem is that the column has no defined height.

Radek Homola
  • 390
  • 1
  • 3
  • 11

7 Answers7

15

You can make the column a flexbox and align the element to the end.

.row {
  background: red;
}

.col-6-md {
  background: lightblue;
  height: 200px;
  display: flex;
}

.bottom {
  background: green;
  align-self: flex-end;
  width: 100px;
  height: 50px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
  <div class="col-6-md">
    <div class="bottom">Bottom</div>
  </div>
</div>
Gerard
  • 15,418
  • 5
  • 30
  • 52
9

in Bootstrap 4, you can use mt-auto on the column itself to align an item to the bottom. It should already be aligned to the left by default

R-D
  • 566
  • 6
  • 13
3

.bottomdiv {
    border: 1px solid red;
    height: 50px;
    width: 50px;
    position:absolute;
    left:0;
    bottom:0;
}
.col-md-6.col-sm-6.col-xs-6 {
    display: table-cell;
    height: auto;
    border: 1px solid black;
    float: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
    <div class="row">
       <div class="parent">
        <div class="col-md-6 col-sm-6 col-xs-6">
             <div class="bottomdiv">
             </div>             
        </div>
        <div class="col-md-6 col-sm-6 col-xs-6">
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
        </div>
    </div>
</div></div>
Dhaarani
  • 1,350
  • 1
  • 13
  • 23
2

In Bootstrap 4

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

For a single column us align-self-end on the col

Docs: https://getbootstrap.com/docs/4.0/utilities/flex/#align-items

Yevgeniy Afanasyev
  • 37,872
  • 26
  • 173
  • 191
1

You can also try using the absolute CSS functionality

.bottom {
   position: absolute;
   bottom: 0;
   left: 0;
}

then check the position, alter it to suite you

Lord Kay
  • 35
  • 2
-1

So it was pretty cool:

.bottom{
    position:absolute;
    bottom: 0.99rem;
}
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 30 '22 at 01:22
-4

If you don't want to play with css you can just set:

class="mb-0"

It will set margin bottom to zero and should drop your content to the bottom of whatever cell it's in You can align it in other directions similar way: mb, mt, mr, ml

mariubog
  • 1,498
  • 15
  • 16