Bug with transform: scale and overflow: hidden in Chrome

前端 未结 13 1420
不知归路
不知归路 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:58

    Here is the Solution.

    The HTML:

    The CSS:

    .wrap{
        width: 400px;
        height: 260px;
        overflow: hidden;
        border-radius: 15px;
        border:1px solid transparent;
    }
    div.image{
        background: url(http://blog.dothegreenthing.com/wp-content/uploads/2012/10/take-a-smile.jpg) no-repeat;
        width: 400px;
        height: 260px;
    
    
    }
    div.image:hover{
        -webkit-transform: scale(1.2, 1.2);
        transform: scale(1.2, 1.2);
        cursor: pointer;
        border:1px solid transparent;
    }
    

    Chrome needs a transparent border surrounding the box. Hope this helps.

提交回复
热议问题