0

html, body{
   margin:0;
  padding: 0;
}
div {
  background: crimson;
  width: 100vw;
  height: 100vh;
}
.clip {
  -webkit-clip-path: url(#svgPath);
  clip-path: url(#svgPath);
}
<div class="clip">
  Test
</div>
<svg width="0" height="0">
  <defs>
    <clipPath id="svgPath">
      <path id="masksvg" d="M0,0H1449L828,900H0V0Z" />
    </clipPath>
  </defs>
</svg>

svg clip shape path is not responsive. http://codepen.io/praveenvijayan/full/PZMxqG

I tried adding objectBoundingBox.

I created a code snippet with minimum test case. Please view it in full screen to see the mask.

SVG

 <svg width="0" height="0">
  <defs>
     <clipPath id="svgPath" clipPathUnits="objectBoundingBox">
        <path id="masksvg" d="M0,0H1449L828,900H0V0Z"/> 
     </clipPath>
  </defs>
</svg>

CSS

.clip {
   -webkit-clip-path: url(#svgPath);
   clip-path: url(#svgPath);
}

enter image description here

Praveen Vijayan
  • 6,521
  • 2
  • 29
  • 28

0 Answers0