gpt4 book ai didi

html - 剪辑路径在 Firefox 中不起作用 [% 值]

转载 作者:太空狗 更新时间:2023-10-29 13:22:10 25 4
gpt4 key购买 nike

我试图在 mozilla 中运行 svg clip-path 但它不起作用。

.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%);
}

它在 chrome 中完美运行。谁能帮我解决 mozilla 和其他浏览器的问题?

最佳答案

您可以在 Firefox 中使用内联 SVG(如下面的代码所示),其中您的分数是百分比/100。由于 clipPathUnits 属性,掩码将响应。

<svg width="0" height="0">
<defs>
<clipPath id="clip-shape" clipPathUnits="objectBoundingBox">
<polygon points="0 0, 0.58 0, 0.39 0.818, 0 0.818" />
</clipPath>
</defs>
</svg>

引用svg like

.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%);
-webkit-clip-path: url("#clip-shape");
clip-path: url("#clip-shape");
}

我为此苦苦挣扎,因为我的 svg 是动态添加到页面的。通过 js 延迟(或页面加载)应用 clip-path css-property 解决了我在 FF 中的问题。

据我所知,IE 不支持。

关于html - 剪辑路径在 Firefox 中不起作用 [% 值],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33816793/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com