MDN released a comprehensive guide to Flexbox with new and updated materials by Rachel Andrew. The guide includes 11 posts demonstrating layouts, use cases and everything you could possibly want or need to know on the topic. All of the related Flexbox properties are nicely and conveniently attached to the table of contents, making this extremely easy to use.
Chris showed us a little while back that CSS grid areas and their elements are not necessarily the same size. It's an interesting point because one might assume that putting things into a grid area would make those things occupy the entire space, but grid areas actually reserve the space defined by the grid and set the element's
align-items properties to a
stretch value by default.
So... yes, they are the same size, but not necessarily.
Chris ended his post by asking "who cares?" while indicating no one in particular. The point was much more geared toward calling this out as a starting point for folks who need to align content in the grid.
I'm not sure I have a better answer, but it made me think it would be fun if we could leverage those auto-assigned
stretch values to adapt a user interface in interesting ways.
One of the most powerful and convenient CSS Grid features is that, in addition to explicit column sizing, we have the option to repeat-to-fill columns in a Grid, and then auto-place items in them. More specifically, our ability to specify how many columns we want in the grid and then letting the browser handle the responsiveness of those columns for us, showing fewer columns on smaller viewport sizes, and more columns as the screen estate allows for more, without needing to write a single media query to dictate this responsive behavior.
CSS grid, along with a handful of other new CSS properties, are revolutionizing web design. Unfortunately, the industry hasn't embraced that revolution yet and a lot of it is centered around fear that we can trace back to problems with the current state of CSS grid tutorials.
The majority of them fall into one of two categories:
- Re-creating classic web design patterns. Grid is great at replicating classic web design patterns like card grids and "holy grail" pages.
- Playing around. Grid is also great for creating fun things like Monopoly boards or video game interfaces.
These types of tutorials are important for new technology. They're a starting point. Now is the time, as Jen Simmons says, to get out of our ruts. To do that, we must cast off our design fears.
Here’s a nifty post by Jonathan Snook where he walks us through how to make a calendar interface with CSS Grid and there’s a lot of tricks in here that are worth digging into a little bit more, particularly where Jonathan uses
grid-auto-flow: dense which will let Grid take the wheels of a design and try to fill up as much of the allotted space as possible.
As I was digging around, I found a post on Grid’s auto-placement algorithm by Ian Yates which kinda fleshes things out more succinctly. Might come in handy.
Oh, and we have an example of a Grid-based calendar in our ongoing collection of CSS Grid starter templates.