Problem: Overlapping avatars.

Solution#

html
<div class="flex -space-x-2">
  <img class="h-8 w-8 rounded-full ring-2 ring-white" src="a.jpg" alt="" />
  <img class="h-8 w-8 rounded-full ring-2 ring-white" src="b.jpg" alt="" />
</div>

Why this works#

-space-x-2 overlaps; ring-2 ring-white creates separation borders.

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