github.com/angrybunnyman.com

Portrait of the Man as a...

Glow Cards - Blaugust the Twenty-fifth

Post Nutrition Label

  • Content Type: Text
  • Read Time: 10 min
  • Topics: Accessibility, CSS
  • Mood: Caffeinated

I happened upon Sylvia's blog and was consumed by the corkboard styling of her notes. I had to have it and, as is my ravenous wont, I bestowed upon it an eerie glow. As we do around here.

IMG_0415

Below is how to do it entirely with CSS. It respects prefers-reduced-motion as well because accessibility matters.

What this does

Assumptions

Your cards are list items in a blog posts list. If your HTML differs, tweak the selector below.

<ul class="embedded blog-posts">
  <li>Post A…</li>
  <li>Post B…</li>
  <li>Post C…</li>
</ul>

CSS (glow + animation + accessibility)

This uses your existing --accent-color theme variable. If you don't have one, you can define it on :root. If you do, it'll work and, here, respects dark/light mode selection. (e.g., --accent-color: #92ff36;).

/* The breathing glow animation */
@keyframes breathing-glow 
{
  0%, 100% {
    box-shadow: 0 0 0.3em var(--accent-color);
  }
  50% {
    box-shadow: 0 0 1em var(--accent-color);
  }
}

/* Apply the animation to each card */
body:not(.home) ul.embedded.blog-posts li 
{
  --breath-duration: 6s;    /* shared duration */
  animation: breathing-glow var(--breath-duration) ease-in-out infinite;
  border-radius: 0.5rem;
}

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) 
{
  body:not(.home) ul.embedded.blog-posts li {
    animation: none;
  }
}

Variations (optional)

Troubleshooting

Why this is accessible

If you are here, you can see it at the bottom of this scrawl. Here also, all reading Eye, is a demonstration of the accessibility settings controlling it, like a helpful assistive puppet.

Happy glowing. May your corkboard breathe---softly, strangely, and with unending persistence.

Reply on Bluesky ⤤ Reply by Email (or just say hi!) Reply on Mastodon ⤤

#CSS #blaugust