jesders88 jesders88 - 21 days ago 6
CSS Question

Align content in a flex container to the bottom

Is there a way to have equal height items in flexbox and align all of the content within that container to the bottom?

Currently this is what I have



.quick-menu .menu {
font-size: 0;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.quick-menu .menu .item {
margin-top: 30px;
width: 33.33%;
align-self: flex-end;
}
.quick-menu .menu .item > img {
margin: auto;
}
.quick-menu .menu .item > span {
font-size: 24px;
font-weight: $bold;
color: $white;
text-align: center;
display: block;
}

<div class="menu">
<div class="item">
<img src="/assets/img/menu/sandwiches.png" alt="Frozen Igloo Sandwiches">
<span>Sandwiches</span>
</div>
<div class="item">
<img src="/assets/img/menu/frozen-custard.png" alt="Frozen Igloo Frozen Custard">
<span>Frozen Custard</span>
</div>
<div class="item">
<img src="/assets/img/menu/munchies.png" alt="Frozen Igloo Munchies">
<span>Munchies</span>
</div>
<div class="item">
<span><img src="/assets/img/menu/handcrafted-treats.png" alt="Frozen Igloo Handcrafted Treats">
<span>Handcrafted Treats</span>
</div>
<div class="item">
<img src="/assets/img/menu/fountain-sodas.png" alt="Frozen Igloo Fountain Sodas">
<span>Fountain Sodas</span>
</div>
<div class="item">
<img src="/assets/img/menu/specialty-sundaes.png" alt="Frozen Igloo Specialty Sundaes">
<span>Specialty Sundaes</span>
</div>
</div>




Answer

Yes, but since you don't have a specified height on the container, it defaults to height: auto (content height), and there's no free space to move down.

Once you define a height which allows for extra space, the items can move down with align-items: flex-end on the container, or align-self: flex-end on the items (like you have).