Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clip-path doesn't work in firefox [% values]

I am trying to run svg clip-path in mozilla but it doesn't work.

.mask-1 {
    -webkit-clip-path: polygon(0% 0%, 58% 0%, 39% 81.8%, 0% 81.8%);
    clip-path: polygon(0% 0%, 58% 0%, 39% 81.8%, 0% 81.8%);
}

It works in chrome perfectly. Can anyone can help me out with mozilla and other browsers?

like image 251
user4821826 Avatar asked Nov 20 '15 00:11

user4821826


1 Answers

I've also struggled a lot with this. I'm covering similar ground as the above answer, but a solution I found was to add the CSS inline using a Style tag. It's ugly, but works at least.

<div class="clip-this" style="background:red; height: 200px; width: 200px;"></div>

<!-- this lets Firefox display the angle -->
<svg class="clip-svg">
	<defs>
		<clipPath id="swipe__clip-path" clipPathUnits="objectBoundingBox">
			<polygon points="0.404 0, 1 0, 1 1, 0 1" />
		</clipPath>
	</defs>	
</svg>

<style>
  .clip-this {
	clip-path: polygon(40.4% 0, 100% 0, 100% 100%, 0 100%);
	clip-path: url("#swipe__clip-path");

}
</style>
like image 131
atomictom Avatar answered Oct 05 '22 05:10

atomictom