background-size transition on hover causes chrome to “shake” background image

前端 未结 3 1110
遥遥无期
遥遥无期 2021-01-18 03:11

I am trying to achieve an effect I saw recently, where background image zooms on hover. I pretty much did it with example here: https://jsfiddle.net/qyh6nbwt/ but it seems t

3条回答
  •  一向
    一向 (楼主)
    2021-01-18 03:39

    just use transform, scale.

    so just instead of setting the bg image to 160% use

    transform:scale(1.5);
    

    some information about the transform css property you can find here

    to use the transform scale in your case you will need a wrapper with overflow hidden so just the inner div gets bigger and cut of by the outer div.

    see updated fiddle.

    greetings timmi

提交回复
热议问题