Bug with transform: scale and overflow: hidden in Chrome

前端 未结 13 1419
不知归路
不知归路 2020-11-28 03:54

Working with CSS3 property transform: scale, I found interesting issue. I wanted to make a little zoom effect for pictures. But when I used for the parent div <

13条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 04:37

    I have been after this for long time and only thing that has worked for me is this rotate(0.1deg) translateZ(0) . So if you are scaling the element

    .something:hover img{
    
        -webkit-transform: scale(1.1) rotate(0.1deg) translateZ(0);
        -moz-transform: scale(1.1) rotate(0.1deg) translateZ(0);
        -o-transform: scale(1.1) rotate(0.1deg) translateZ(0);
        transform: scale(1.1) rotate(0.1deg) translateZ(0);
    
    }
    

    without the rotate the fix does not work on my end.

    If you add transform to ANY img parent ( like rotate the container where the image is ) , you need to add same fix to the element for example

    .something_parent{
        transform: translate(-9%,9%) rotate(0.1deg) translateZ(0);
        -webkit-transform: translate(-9%,9%) rotate(0.1deg) translateZ(0);
        -mos-transform: translate(-9%,9%) rotate(0.1deg) translateZ(0);
        -o-transform: translate(-9%,9%) rotate(0.1deg) translateZ(0);
    }
    

提交回复
热议问题