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.

  1. 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.
  2. 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.
  3. Some person (no byline) that uses the stack technique, but uses an animation to determine which one is on top rather than random(). Better support.
  4. Kilian said he’d also stack links, but use an 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() (???).

Share.
Leave A Reply