Search
Implicit Grids, Repeatable Layout Patterns, and Danglers
2.8.2022
Dave Rupert with some modern CSS magic that tackles one of those classic conundrums: what happens when the CSS for component is unable to handle the content we throw at it?
The specific situation is when a layout grid expects …
Implicit Grids, Repeatable Layout Patterns, and Danglers...
Conditionally Styling Selected Elements in a Grid Container
15.6.2022
Calendars, shopping carts, galleries, file explorers, and online libraries are some situations where selectable items are shown in grids (i.e. square lattices). You know, even those security checks that ask you to select all images with crosswalks or whatever.
🧐…
Conditionally...
CSS Pseudo Commas
30.8.2021
A bonafide CSS trick if there ever was one! @ShadowShahriar created a CodePen demo that uses pseudo-elements to place commas between list items that are displayed inline, and the result is a natural-looking complete sentence with proper punctuation.
CodePen Embed…
The post CSS Pseudo Commas...
:nth-child Between Two Fixed Indexes
29.6.2021
I needed to select some elements between two fixed indexes the other day — like literally the second through fifth elements. Ironically, I have a whole post on “Useful :nth-child Recipes” but this wasn’t one of them.
The answer, it …
The post :nth-child Between Two Fixed...
Pseudo-Randomly Adding Illustrations with CSS
17.4.2020
Between each post of Eric Meyer’s blog there’s this rather lovely illustration that can randomly be one of these five options:
Eric made each illustration into a separate background image then switches out that image with the nth-of-type CSS property, like this:
.entry:nth-of-type(2n+1)::before...
CSS :nth-of-class selector
23.3.2020
That's not a thing.
But it kinda is!
Bram covers how frustrating .bar:nth-child(2) is. It's not "select the second element of class .bar." It's "select the second element if it also has the class .bar." The good news? There is a real selector that does the former:
:nth-child(2 of .bar) { }
Safari...
Staggered CSS Transitions
14.8.2019
Let's say you wanted to move an element on :hover for a fun visual effect.
@media (hover: hover) {
.list--item {
transition: 0.1s;
transform: translateY(10px);
}
.list--item:hover,
.list--item:focus {
transform: translateY(0);
}
}
Cool cool. But what if you had several list...