I had fun with the post about making a link to a random post in just HTML/CSS the other day. But I was almost certainly over-thinking it on the original. Using random() was kind of the point, so we can stick with that.
- One alternative is to think uni-directionally. Making it both rows and columns isn’t necessary out the gate. You can get vertical slices with flexbox easily, which is just as random really, and likely gives you a few hundred random posts as they can get down to 1px in width.
- An even simpler idea is to have all the links be in a “stack” and
random()-ly show just one. See here where each refresh shows a different link. That buys you essentially infinite space. - Some person (no byline) that uses the stack technique, but uses an
animationto determine which one is on top rather thanrandom(). Better support. - Kilian said he’d also stack links (then blogged it!) using and
if()function to only show one of them. - That’s kinda what Alex Riviere tried, but it turns out style queries don’t work with
random()(???). - Roman made it into an
@functionso it’s reusable.