简体   繁体   English

使用CSS3过渡的溢出问题

[英]Overflow issue using CSS3 transition

I'm trying to do a small animation visible on the JsFiddle below. 我正在尝试制作一个在下面的JsFiddle上可见的小动画。

But as you can see the border radius not work during the animation... 但是正如您所看到的,边框半径在动画过程中不起作用...

There is a fix for that? 有解决办法吗?

http://jsfiddle.net/toroncino/V4V97/ http://jsfiddle.net/toroncino/V4V97/

Here is my code: 这是我的代码:

a {
    border-radius: 10px;
    display: inline-block;
    height: 300px;
    overflow: hidden;
}

a img {
    -moz-transition: all .5s ease-in-out;
    -o-transition: all .5s ease-in-out;
    -webkit-transition: all .5s ease-in-out;
    transition: all .5s ease-in-out;
    width: 100%;
    height: 100%;
}

a:hover img {
    -moz-transform: scale(1.1);
    -o-transform: scale(1.1);
    -webkit-transform: scale(1.1);
    transform: scale(1.1);
}

It is a long-standing bug in Webkit (see https://bugs.webkit.org/show_bug.cgi?id=68196 ) inherited by Chromium (see https://code.google.com/p/chromium/issues/detail?id=157218 ) 这是Chromium继承的Webkit中的一个长期错误(请参阅https://bugs.webkit.org/show_bug.cgi?id=68196 )(请参阅https://code.google.com/p/chromium/issues/ detail?id = 157218

A workaround is posted in How to make CSS3 rounded corners hide overflow in Chrome/Opera 解决方法已在如何使CSS3圆角隐藏在Chrome / Opera中的溢出中发布

You basically need to set a CSS Mask on the container element 您基本上需要在容器元素上设置CSS Mask

/*1x1 pixel black png*/
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);

Working demo at http://jsfiddle.net/V4V97/2/ http://jsfiddle.net/V4V97/2/上的 工作演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM