CSS flexbox, just like CSS grid, is really handy when it comes creating a powerful, robust and responsive structure across all devices.
In CSS grid, it’s a bit easier to make the items of equal width. In a flexbox, it’s not hard but it just take a complete understanding of how the flex properties work.
Look at these examples below with few flex items.
As you can see in the first example, when we have items with same number of characters, it doesn’t require any width adjustment. But as you can see in the second example, when we have different kinds of content in different flexbox items then it it requires some kind of width adjustment to make it look good.
You can try to adjust the width of the individual flex items but there is an easier way to do that.
We can use flex shorthand property to make the flex items of equal width.
Just like this example:
flex property is a shorthand property for the flex-grow, flex-shrink, and flex-basis properties. So, if you’d like, you can use all 3 properties separately as well. Just like this example.
examples flex-grow flex-shrink flexbox property style