Agyan
adda
Run
Reset
Copy
Tailwind CSS Tutorial › Tailwind Position and Z-Index › Badge, overlay and floating button
Back to tutorial
Code
Edit, then press Run or Ctrl+Enter
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script> <header class="sticky top-0 z-50 bg-white/80 backdrop-blur border-b px-6 py-3 font-semibold">Sticky header</header> <div class="p-6 space-y-6"> <div class="relative inline-block"> <img src="https://picsum.photos/id/91/80/80" class="size-16 rounded-full" alt="User"> <span class="absolute -top-1 -right-1 bg-rose-600 text-white text-xs size-6 rounded-full flex items-center justify-center">3</span> </div> <div class="relative h-48 rounded-xl overflow-hidden"> <img src="https://picsum.photos/id/1036/800/300" class="w-full h-full object-cover" alt="Snow"> <div class="absolute inset-0 bg-black/40 flex items-end p-4"> <h3 class="text-white text-xl font-bold">Image with overlay</h3> </div> </div> <div class="h-96">Scroll down to see the sticky header stay on top.</div> </div> <a href="#" class="fixed bottom-6 right-6 bg-green-500 hover:bg-green-600 text-white rounded-full px-5 py-3 shadow-lg">Chat on WhatsApp</a>
Result