CSS Animation Overflows It's Parent, Despite Overflow: Hidden

↘锁芯ラ 提交于 2019-12-10 21:43:23

问题


I'm trying to do a "material" animation, where a pseudoelement expands on hover.

Demo:

http://codepen.io/Tiger0915/pen/WbxyJB

On hover, a span:after scales up to fill it's parent.

But look closely at the corners of the li during the transition, you can see that it overflows the border-radius.

I have:

li {
  overflow: hidden;
  border-radius: 8px;

  &:hover span:before {
        @include transform(scale(5));
  }
}

But for some reason when it's animating, the overflow: hidden doesn't work on the corners of the li, which are rounded with border-radius.

Why doesn't the overflow: hidden work with my border-radius, only when the transition is happening?

Note: This happens only in Chrome.


回答1:


I edited your code see results here

it chrome BUG with scale and overflow .

for the container that have the ( overflow:hidden ) add ( in your case its the li )

position:relative;
z-index:1;


来源:https://stackoverflow.com/questions/27610940/css-animation-overflows-its-parent-despite-overflow-hidden

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!