Grid for Simple Layout – Why?

In the third part of the series, Grid is used to create the layout, even though it appears to be a one-dimensional layout. I’m wondering why Grid was chosen instead of Flexbox for this. Wouldn’t Flexbox be more suitable for a simpler, one-dimensional layout?

You could you flex to create it but I think grid is better in this case. With flex, you have to take into consideration when you resize the screen and calculate so you have 3 column (width and height of items in flex and flex-grow on each items). If you add one more, it might go on the next line. With grid, you have more control on this since you just need to adjust grid-template-column which is easier.

2 Likes