Sometimes, we want to add CSS vertical alignment text inside li.
In this article, we’ll look at how to add CSS vertical alignment text inside li.
How to add CSS vertical alignment text inside li?
To add CSS vertical alignment text inside li, we use flexbox.
For instance, we write
li {
display: flex;
flex-direction: row;
align-items: center;
}
to make the li elements flex containers with display: flex;
.
We make the flex direction horizontal with flex-direction: row;
.
And we vertically center the items inside each li with align-items: center;
.
Conclusion
To add CSS vertical alignment text inside li, we use flexbox.