css 'clip-path' 在 Firefox 中不起作用

标签 css firefox

我正在使用剪辑路径和边框半径创建头像 basemap ,以显示背景颜色。 Firefox 不会呈现剪切路径,即使使用供应商前缀也是如此。

感谢任何帮助。

html:

<div class="avatar-wrapper">
<div class="circle-underlay">&nbsp;</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%);
}

http://jsfiddle.net/LyDHP/

最佳答案

如果您使用以下 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;
}

You can achieve the required result

关于css 'clip-path' 在 Firefox 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23740001/

相关文章:

html - XenForo:如何设置@imagePath?

css - Chrome : how to turn off user agent stylesheet settings?

html - 如何从 Firefox 中的 <area> 元素中删除虚线边框?

javascript - Hammerjs panend 在 Firefox 中无法工作

javascript - toFixed() 替换函数

.net - Firefox 发送请求两次

javascript - Firefox - 在 contenteditable 中聚焦一个段落

javascript - 如何始终在 Lightbox 2 上显示导航按钮?

javascript - 使用带箭头的 MaterializeCSS 轮播 - 如何使用普通 javascript 进行初始化

javascript - 按钮未显示在 Firefox WebExtension 通知中