Site Logo Mukhthar CM Home

Zoom Image on Hover in Tailwind CSS

Jan 13, 2022 1 min read

Have you seen those cool animations on websites, when we hover on an Image, it zooms in? Doing such kind of a thing is pretty easy in tailwind CSS.

Tailwind got classes for almost anything. We can scale something by adding a scale-125 class. We can control the transition duration with duration-500 etc.

When we combine both of these we can get the cool image zoom animation.

I’ve added the sample code below.

Have fun!

<div class="text-center m-20 border-2 rounded-md">
  <div class="h-min overflow-hidden rounded-md">
    <img class="hover:scale-125 transition-all duration-500 cursor-pointer" src="" alt="" />
  <h3 class="text-3xl py-4">Our Mission</h3>
  <span class="text-lg text-gray-700"> Lorem ipsum, dolor sit amet consectetur adipisicing elit. Explicabo earum quos voluptatum tempore quis exercitationem, ad officiis dolorum temporibus veritatis quod itaque repellendus molestiae culpa laboriosam, cupiditate voluptate. Eius, placeat! </span>

Join my email list to get the latest posts and updates.