正如您在此处看到的(小提琴),a
是父级并设置为overflow: hidden;
. span
是孩子并已box-shadow
设置。当什么都没有发生时,一切都很顺利,但是当用户将鼠标悬停时a
,它的overflow
属性似乎被覆盖了(即阴影显示为正方形,而不是应该的圆形)。知道如何解决这个问题吗?
代码: HTML
<a href="#" title="Hover me"><span>Hover me</span></a>
CSS
a {
overflow: hidden;
width: 52px;
height: 52px;
top: 0;
display: block;
position: relative;
margin: 50px;
background: red;
-webkit-transition: all 300ms linear;
-moz-transition: all 300ms linear;
-ms-transition: all 300ms linear;
-o-transition: all 300ms linear;
transition: all 300ms linear;
border-radius: 200px;
opacity: 0.6;
}
a:hover {
opacity: 1;
top: -8px;
}
a > span {
width: 100%;
height: 100%;
display: block;
box-shadow: inset 0 -35px 10px rgba(0,0,0,0.8);
}
a:hover > span {
box-shadow: inset 0 -28px 10px rgba(0,0,0,0.8);
}