Smooth Image Zoom on Hover with CSS

This simple CSS hover effect will subtly & smoothly scale an image 20% larger on hover.


<a class="box" href="">
    <img src="" alt="FPO Image">


/* Make a square box with overflow hidden */
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;

/* Set image to cover entire box */
.box img{
    position: absolute;
    top: 0;
    object-fit: cover;
    object-position: center;
    width: 100%;
    height: 100%;
    z-index: 1;
    transition: transform 8s ease-out;

/* Scale image on hover */
.box:hover img{
    transform: scale(1.2);

Leave a Reply

Your email address will not be published. Required fields are marked *