尝试在 Safari 中让 css3 在图像的边框半径上轻松过渡。
它只是闪烁到悬停状态,而不是平滑过渡。任何帮助都非常感谢。我的代码如下:
.CSS:
.all a:hover img {
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=100);
-moz-opacity:1;
-khtml-opacity: 1;
opacity: 1;
-webkit-filter: grayscale(0%);
}
.all a img {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
width: 50%;
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=90);
-moz-opacity:0.9;
-khtml-opacity: 0.9;
opacity: 0.9;
}
.all a img {
-moz-transition: all .3s ease;
-webkit-transition: all .3s ease;
-o-transition: all .3s ease;
transition: all .3s ease;
}
.all a img {
-webkit-filter: grayscale(100%);
transition: border-radius .3s ease;
-moz-transition: -moz-border-radius .3s ease,border-radius .3s ease;
-webkit-transition: -webkit-border-radius .3s ease,border-radius .3s ease;
}
.HTML:
<ul class="thumbs">
<li class="all identity">
<a href="projects/project_identity/index.html"><img src="https://imjoeybrennan.com/images/logos_t.jpg" alt="Logos"/></a>
</li>
</ul>
链接到网站:https://imjoeybrennan.com
以下内容应用于父元素,并应用边框半径将webkit踢回我的行中:
-webkit-mask-image: -webkit-radial-gradient(white, black);
另一种选择是将元素包装在两个边框半径父项中。
对我来说似乎很笨拙,但比双包装选项要好得多——有兴趣听到其他解决方案。
这是一个简单的修复,Safari 不支持从像素到百分比的过渡。如果将悬停样式从 50% 更改为 100px,您将看到过渡将顺利进行。
.all a:hover img {
-webkit-border-radius: 100px;
-moz-border-radius: 100px
border-radius: 100px;
}
您可能希望将它们设置为图像高度和宽度两倍的任何值,以确保它们在悬停时始终是圆形的。