CSSGridTips's profile picture. A daily tip on using CSS Grid! Created by @jensimmons

CSS Grid

@CSSGridTips

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

Don’t assume creating a layout with Grid plus smart fallbacks is “twice as much work”. Turns out, it’s not.


CSS Grid さんがリポスト

Using CSS Grid to implement the same old 12-column grid designs is like making a film with a steadycam — and always standing still.


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


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!


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;`


By explicitly placing items, you can tell the browser to lay things out in such a way that items overlap. Overlapping is *amazing*!


CSS Grid さんがリポスト

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


CSS Grid さんがリポスト

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


CSS Grid さんがリポスト

…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


CSS Grid さんがリポスト

…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


CSS Grid さんがリポスト

…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


CSS Grid さんがリポスト

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


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…


Learning Grid is easier than learning Flexbox. There is more to learn, but it makes more sense. (Especially since we’ve been misusing Flexb)


`minmax()` is a fantastic new way to define sizes. Example: `minmax(150px, 350px)` means make this thing a minimum of 150px & maximum of 350


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.


Either let the auto-placement algorithm place items — in which case you don’t need breakpoints. Or explicitly place items — and then you do.


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.


Loading...

Something went wrong.


Something went wrong.