{"id":247172,"date":"2016-11-02T06:20:19","date_gmt":"2016-11-02T13:20:19","guid":{"rendered":"http:\/\/css-tricks.com\/?p=247172"},"modified":"2019-03-20T15:48:12","modified_gmt":"2019-03-20T22:48:12","slug":"things-ive-learned-css-grid-layout","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/things-ive-learned-css-grid-layout\/","title":{"rendered":"Things I’ve Learned About CSS Grid Layout"},"content":{"rendered":"

The following is a guest post by Oliver Williams. Oliver has been working with CSS grid layout and has learned quite a bit along the way. In this article he’s going to hop around to different concepts that he’s learned on that journey. I like this idea of learning little bite-sized chunks about grid layout, through isolated examples where possible. That makes learning the whole thing<\/a> a bit less intimidating.<\/em><\/p>\n

<\/p>\n

CSS grid looks set to land in browsers in early 2017. Until then you will need to enable grid for it to work<\/strong> (except in Firefox Nightly where it is enabled by default). Chrome Canary currently has the best implementation.<\/em> Meanwhile, Firefox has an invaluable add-on called CSS Grid Inspector, which can display the lines of your grid. It is currently the only browser to have such a tool.<\/p>\n

In Chrome enter `chrome:\/\/flags` into your address bar, find \u2018Enable experimental Web Platform features\u2019 and click enable. IE and Edge have old implementations different from the current spec, and are therefore not recommended for experimenting with grid at this point in time.<\/p>\n

You can’t have tetris-shaped grid areas<\/h3>\n

You’ll work this out pretty quickly for yourself.<\/p>\n

\"\"
Your grid areas can only be rectangles (like the left), not arbitrary polygons (like the right).<\/figcaption><\/figure>\n

Grid is designed to be used with<\/em> flexbox, not instead of it<\/h3>\n

Grid and flexbox can act in similar ways. You may have seen people using flexbox to construct grid systems but that’s not what flexbox was designed for. It’s worth reading Jake Archibald’s blog post Don’t use flexbox for overall page layout<\/a><\/em>.<\/p>\n

A quick way to think about it is:<\/p>\n