【发布时间】:2018-08-10 11:37:44
【问题描述】:
我必须制作一个隐藏::before 的按钮,该按钮显示在:hover 上。该动画在 Chrome、IE 和 Firefox 上运行良好,但我在 Safari 上遇到了一个奇怪的问题。
溢出:隐藏正在工作,但没有边界半径。
你应该在 safari 中运行 fiddle 来查看这个问题。
谢谢!
.btn{
border-radius: 3rem;
cursor: pointer;
display: inline-block;
font-size: 15px;
font-weight: 400;
font-family: arial;
overflow: hidden;
position: relative;
padding: 0.8rem 2.5rem;
text-decoration: none;
}
.btn-primary{
background-color: blue;
border-color: blue;
color: white;
}
.btn-primary::before{
background-color: deeppink;
border-radius: 50%;
content: '';
color: white;
height: 100%;
left: 100%;
margin: 0;
position: absolute;
top: 0;
transform-origin: 100% 50%;
transform: scale3d(1, 1.4, 1);
transition: all 300ms cubic-bezier(0.7,0,0.9,1);
width: 20%;
}
.btn-primary:hover::before{
transform: scale3d(1, 5, 1);
width: 110%;
left: -2%;
z-index: 0;
}
.btn-primary span{
position: relative;
z-index: 1;
}
<a href="#" class="btn btn-primary">
<span>Button primary</span>
</a>
【问题讨论】:
-
您在 Mac 或 Windows 系统上的 Safari 中尝试过吗?我对 Windows Safari 的体验是它非常有问题。
-
我在 Mac 上试过这个
-
像here这样将-webkit-标签添加到您的css时是否得到相同的结果?
-
我在我的项目中使用了 autoprefixer,所以它会自动添加我需要的每个 -webkit 标签