Sometimes, we want to add equal height rows in a flex container with CSS.
In this article, we’ll look at how to add equal height rows in a flex container with CSS.
How to add equal height rows in a flex container with CSS?
To add equal height rows in a flex container with CSS, we set the justify-content
property.
For instance, we write
<div id="wrapper">
<div>foo</div>
<div>bar</div>
<div>baz</div>
</div>
to add some nested divs.
Then we write
#wrapper {
justify-content: stretch;
display: flex;
}
to select the outer div and make it a flex container with display: flex;
.
Then we make the inner divs have the same height with justify-content: stretch;
.
Conclusion
To add equal height rows in a flex container with CSS, we set the justify-content
property.