5

DEMO

Image zoom in on hover is easy.
Image round borders is easy.
Combining them, OK, but round corners disappear during transition.
After transition, round corners are back.
Question: How to retain round corners during transition?

.img-wrapper {
    border-radius: 10px;
}

.img-wrapper img {
    transition: transform .5s ease;
    transform:scale(1);
}

.img-wrapper img:hover {
    transform:scale(1.5);
}
Community
  • 1
  • 1
Ksthawma
  • 1,257
  • 1
  • 16
  • 28

3 Answers3

3

try add this:

.img-wrapper {
    border-radius: 10px;
    position:relative;
    z-index:1;
}

if still not worknig, try something from this question: overflow:hidden ignored with border-radius and CSS transforms (webkit only)

Community
  • 1
  • 1
Pepo_rasta
  • 2,842
  • 12
  • 20
2

add -webkit-mask-image: -webkit-radial-gradient(circle, white, black); to the class img-wrapper and added some style here is the fiddle

Krsna Kishore
  • 8,233
  • 4
  • 32
  • 48
1

Move your border-radius from your wrapper to your image.

.img-wrapper {
    width: 400px;
}

.img-wrapper img {
    border-radius: 10px;
    transition: transform .5s ease;
    transform:scale(1);
}

.img-wrapper img:hover {
    transform:scale(1.5);
}
  • Blue border gone when zoom in. – Ksthawma Sep 03 '15 at 08:29
  • fiddle: no, the requirement is to see the same visible image dimensions while the image zooms in -- seeing less of the sides of the image. Your fiddle shows the entire image while zooming in, so the visible dimensions change. – Ksthawma Sep 03 '15 at 08:52