Problem: Clickable gallery.

Solution#

html
<button class="group relative overflow-hidden rounded-xl">
  <img class="transition group-hover:scale-105" src="p.jpg" alt="" />
  <span class="absolute inset-0 grid place-items-center bg-black/0 transition group-hover:bg-black/30 text-white text-xl opacity-0 group-hover:opacity-100">🔍</span>
</button>

Why this works#

Hover overlay hints interactivity.

Variants#

  • Responsive: add screen prefixes to the core classes
  • Dark: pair each color utility with its dark: twin
  • Animated: add transition + a state variant for motion

cookbook/index|Cookbook index · utilities/index|Utilities reference · patterns/index|Layout patterns