DEV Community

Cover image for 
Do CSS Grid replace Flexbox?
Nava
Nava

Posted on

3 2

Do CSS Grid replace Flexbox?

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.

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay