I'm trying to use the clip-path property with an path value. But for some reason, the clipping isn't scaling with the element, like it does using an HTML svg as url().
Is there a way to make path() behave like url() does (stretching the clipping)
NOTE: i also tried to generate an url-encoded svg and used clip-path: url('data:image...') but it doesn't seem to work
.heart {
background: red;
color: white;
display: grid;
place-content: center;
width: 180px;
height: 100px;
margin: 30px auto;
}
.svg {
clip-path: url(#myPath)
}
.path {
clip-path: path('M15,45 A30,30,0,0,1,75,45 A30,30,0,0,1,135,45 Q135,90,75,130 Q15,90,15,45 Z')
}
<div class="heart svg">With SVG</div>
<div class="heart path">With PATH</div>
<svg>
<clipPath id="myPath" clipPathUnits="objectBoundingBox">
<path d="M0.5,1
C 0.5,1,0,0.7,0,0.3
A 0.25,0.25,1,1,1,0.5,0.3
A 0.25,0.25,1,1,1,1,0.3
C 1,0.7,0.5,1,0.5,1 Z" />
</clipPath>
</svg>