css'clip-path'在Firefox中不工作 [英] css 'clip-path' doesn't work in Firefox
本文介绍了css'clip-path'在Firefox中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用剪辑路径和边框半径创建头像底图,以显示背景颜色。即使使用了供应商前缀,Firefox也不会渲染剪切路径。
I'm creating an avatar underlay using clip-path, and border radius, to show a background colour. Firefox won't render the clipping path, even when the vendor prefix is used.
任何帮助。
html:
<div class="avatar-wrapper">
<div class="circle-underlay"> </div>
<img class="avatar-img" src="http://www.gravatar.com/avatar/6caf8757aa60bda77594e8d8fdd819d9?s=38" width="38" height="38" />
</div>
CSS:
.avatar-wrapper{
position: relative;
width: 48px;
height: 48px;
}
.circle-underlay {
border-radius: 50%;
width: 48px;
height: 48px;
background:#cc3300;
position: absolute;
top: 0px;
left: 0px;
}
.avatar-img{
position: absolute;
top:5px;
left: 5px;
-moz-clip-path: circle(50%,50%,50%);
-webkit-clip-path: circle(50%,50%,50%);
clip-path: circle(50%,50%,50%);
}
推荐答案
如果您使用以下HTML:
If you use the following HTML:
<div class="avatar-wrapper">
<img class="avatar-img" src="http://www.gravatar.com/avatar/6caf8757aa60bda77594e8d8fdd819d9?s=38" width="38" height="38" />
</div>
和css:
.avatar-wrapper{
position: relative;
width: 38px;
height: 38px;
border:5px solid #cc3300;
border-radius:50%;
overflow:hidden;
}
这篇关于css'clip-path'在Firefox中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文