DEV Community

Cover image for 
Do CSS Grid replace Flexbox?

Do CSS Grid replace Flexbox?

Curious 😉and inquisitive guy building🚀 things like coding, writing🎗 technical documents and working on 💻open source projects with javascript, html and css
・1 min read

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.

Discussion (0)

Forem Open with the Forem app