Sometimes, we want to align content of a div to the bottom with CSS.
In this article, we’ll look at how to align content of a div to the bottom with CSS.
How to align content of a div to the bottom with CSS?
To align content of a div to the bottom with CSS, we use flexbox.
For instance, we write
div.parent {
display: flex;
height: 100%;
}
span.child {
display: inline-block;
align-self: flex-end;
}
to make the parent div a flex container with display: flex;
.
And we align the child span at the bottom of the div with align-self: flex-end;
.
Conclusion
To align content of a div to the bottom with CSS, we use flexbox.