<svg xmlns="http://www.w3.org/2000/svg" viewBox="8 12 48 39.66"><path d="M 8 48 C 27 59 37 41 56 48 L 32 12 L 18 23 Z M 8 21 L 18 23" fill="#000000"/></svg>
注:位置也比较重要,路径坐标定义使用负值,可能超出容器的可视范围。
SVG 转为 CSS
clip-path 支持 path() 函数,可以直接将 SVG 的路径信息嵌入到 CSS 中。
代码
<divclass="svg-shape"></div>
.svg-shape{width: 100px;height: 100px;background-color: black;clip-path:path('M 8 48 C 27 59 37 41 56 48 L 32 12 L 18 23 Z M 8 21 L 18 23');}