CSS Grid (@CSSGridTips) profile picture

A daily tip on using CSS Grid! Created by @jensimmons

Joined May 2017
Photo by CSS Grid (@CSSGridTips)
Don’t assume creating a layout with Grid plus smart fallbacks is “twice as much work”. Turns out, it’s not.
4
1
14
Don’t assume creating a layout with Grid plus smart fallbacks is “twice as much work”. Turns out, it’s not.
4
1
14
Using CSS Grid to implement the same old 12-column grid designs is like making a film with a steadycam — and always standing still.
8
55
3
178
Use Firefox to see your lines with the Grid Inspector in Dev Tools: 1) Inspect. 2) Find where it says display:grid. 3) Click the waffle icon
9
9
Add / subtract <li>s. See what happens. Add more `1fr`. See what happens. Add a `2fr`, or `1.5fr`. See what happens. You’re doing it!
1
2
8
Have you not tried CSS Grid yet? Do! Open codepen.io. Make a list. On the <ul>, apply `display:grid; grid-template-columns: 1fr 1fr 1fr;`
2
14
2
35
By explicitly placing items, you can tell the browser to lay things out in such a way that items overlap. Overlapping is *amazing*!
2
7
No one is saying Thou Shalt Use CSS Grid. Especially not to ship the same old exact layouts. Let’s not get religious. Or anti-religious. / 6
2
11
No reason to HAVE to use CSS Grid. No guilt. No pressure. It’s a new opportunity, not a mandate. You *can* get amazing new results. / 5
1
3
8
…use CSS Grid to do something new. That isn’t possible without it. (With a simple fallback layout for browsers that don't support it.) / 4
1
2
6
…make the time to learn Grid. Learn the code, or if you don’t code, learn the new mental model of what’s newly possible. And use it to… / 3
1
1
6
…that’s the same, same mental model, same results, then use today’s tools. Nothing wrong w/that! At some point, take the time to learn… / 2
1
1
6
This week, my best advice for using CSS Grid is this: it’s very different from the frameworks we’ve been using. If you want a tool that… / 1
2
8
1
15
CSS Grid is not the last or only CSS tool you will use for layout. It’s a piece of a larger puzzle — that includes Flexbox, Writing Modes…
4
7
Learning Grid is easier than learning Flexbox. There is more to learn, but it makes more sense. (Especially since we’ve been misusing Flexb)
1
2
6
`minmax()` is a fantastic new way to define sizes. Example: `minmax(150px, 350px)` means make this thing a minimum of 150px & maximum of 350
1
15
1
40
Don’t assume using CSS Grid is harder than a layout framework. Learning something new takes effort. But once you know Grid it’s much easier.
1
5
1
24
Either let the auto-placement algorithm place items — in which case you don’t need breakpoints. Or explicitly place items — and then you do.
1
5
4
CSS Grid will let us use fixed-sized images again (if we want) in a responsive layout. We can easily combine fixed-size things with fluid.