Reputation: 348
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.
Any help appreciated.
The 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>
The 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%);
}
Upvotes: 1
Views: 4231
Reputation: 11
Good news, the basic support of "clip-path" without svg will be added to Firefox 54, it's still in beta for now but the public released is planed for June 14.
https://developer.mozilla.org/en-US/Firefox/Releases/54
- clip-path now supports basic shapes (bug 1247229).
Upvotes: 1
Reputation: 58412
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>
and css:
.avatar-wrapper{
position: relative;
width: 38px;
height: 38px;
border:5px solid #cc3300;
border-radius:50%;
overflow:hidden;
}
You can achieve the required result
Upvotes: 2