Image credit: Sven Wolferman via maddesigns.de
With the arrival of the CSS Grid, not only can we abandon the bloated flexbox grid frameworks, we can achieve all that flexbox “grid” frameworks can do and more with just plain CSS.
Here are 3 reasons why CSS Grids are to flexboxes what Teslas are to Fiats.
1. CSS Grids make better products
Cleaner HTML, smaller CSS, fewer JavaScript hacks, and better accessibility
Flexbox’s weaknesses are CSS Grid’s strengths. Building two-dimensional layouts using one-dimensional flexboxes results in really messy and unwieldy code. This makes developers sad. In addition it can take much longer to fix strange layout issues.
With CSS Grid however, we can Make Web Layouts Great Again:
- Cleaner HTML: You no longer need HTML flexbox wrappers inside other flexbox wrappers inside other flexbox wrappers, just to place items in the right spot.
- Smaller CSS: Say goodbye to bulky grid frameworks like Bootstrap with over 1,000 lines of CSS code, just to build a fake grid system. The CSS Grid comes as part of CSS, no assembly required. Plus, using CSS Grids makes your CSS much cleaner and more understandable too.
- Better accessibility: With CSS Grids, you don’t need to move HTML around using JavaScript hacks in order to responsively move items around. Breaking the HTML layout this way hurts accessibility anyway. Remember, layout is supposed to be CSS’s job, not HTML.
For developers who’ve grown familiar to their trusty old flexbox grids, shifting towards CSS Grids will take some getting used to. But this effort will benefit your team in the long run — resulting in cleaner code, more productive developers, shorter development times, and a less buggy product.
2. CSS Grids leads to better designs
Unleash the potential of white space, three-dimensional layers, and teleporting webpage items
Designers, rejoice! CSS Grids opens the door for you to create more interesting and ambitious responsive layouts for your website. You are now able to freely move items across a webpage without reluctant developers complaining that this needs tricky workaround coding