Grid is better than flexbox for a number of valid points. There are things grid do better than flexbox and vice versa.On March 2017 with less browser support than flexbox grid was released unprefixed and ready-to-go, in Chrome, Opera, Firefox, and Safari.
Grid is better for whole page layouts than flexbox because using flexbox for layout can cause content shift during loading due to js modifying the DOM which can be used for tools not rules.
Grid can add columns or rows on fly with grid-template-rows
or grid-template-columns
and use grid-gap
property to make home made style page. The flexbox on other hand use its content to layout the page using flex-wrap
and flex-basis
which can essentially implement flex-grow or flex-shrink
the boxes.
Furthermore, Grid uses the auto layout, minmax(), repeat(), and auto-fill which can provide responsive media query alternative.
Flexbox is essentially for laying out items in a single dimension β in a row OR a column. Grid is for layout of items in two dimensions β rows AND columns.
Top comments (0)