Today's newsletter is sponsored by ConfigCat — the feature flag service that helps you release features faster and with less risk. More on them at the end of today's newsletter. Today, I wanted to share a fun little snippet of CSS I learned from my friend Stephanie Eckles awesome SmolCSS website. Let's imagine you've got a bunch of content (maybe some photos or a list or Pokemon characters or something like that), and you want to display them in a grid. The number of items can vary from time to time, as can the width and height of each item. As a result, you can't commit to any sort of specific CSS Grid layout…
A lot of folks reach for Flexbox with
But it also highlights some of the differences between Flexbox and CSS Grid. Flexbox automatically adjusts the container size based on the size of the content inside it. CSS Grid defines a container, and then fits the content inside it. As a result of these differences, using Flexbox means the items don't always line up with each other. There are ways are it using Here's an alternative approach using Stephanie's snippet…
As you can see, the content automatically wraps as well. But unlike with Flexbox, each item has the same width and lines up on a grid. The magic with this one is in the The You'll also notice there's a If you define this on the HTML, it will override
I love this handy little snippet, and find myself using it more and more on client projects. Thanks Stephanie! Are you looking for a service to support dynamic feature flags? ConfigCat is a cross-platform LaunchDarkly alternative that's easy to learn and quick to set up. With SDKs for 19 platforms — including JavaScript, Python, Ruby, Java, and even Rust — you can toggle features on or off without redeploying. ConfigCat subscriptions are the same price regardless of your team size. Get 25% off any paid plan with code Cheers, Want to share this with others or read it later? View it in a browser. |
0 Komentar untuk "[Go Make Things] Automatically wrapping CSS Grid"