Sometimes, we want to right-align flex item with CSS.
In this article, we’ll look at how to right-align flex item with CSS.
How to right-align flex item with CSS?
To right-align flex item with CSS, we set the justify-content property.
For instance, we write
.main {
display: flex;
}
.c {
justify-content: flex-end;
}
to make the element with class main
a flex container with display: flex;
.
Then we right align the elements inside it with justify-content: flex-end;
.
Conclusion
To right-align flex item with CSS, we set the justify-content property.