gpt4 book ai didi

css - 如何在IE和Firefox上创建一个 "clip-path"的圆圈?

转载 作者:行者123 更新时间:2023-11-28 09:35:52 25 4
gpt4 key购买 nike

我有这个用于 cicrle-masking 的片段。它适用于 Chrome。

但是如何在 Firefox 和 IE 上运行它呢?请不要使用 radius-border 解决方案...

.circle {
-webkit-clip-path: circle(100px at 100px 100px);
clip-path: circle(100px at 100px 100px)
}
<img src="http://cp91279.biography.com/Leonardo-da-Vinci_A-Divine-Mind_HD_768x432-16x9.jpg" width="1024" height="768" alt="" class="circle"/>

.圆圈{ -webkit-clip-path: circle(50% at 50% 10%); 剪辑路径:圆(50% 50% 10%);

最佳答案

那么 IE 根本不支持 CSS 剪辑路径,而 Firefox 只支持 url 方法,因此该解决方案几乎是死胡同 - http://caniuse.com/#feat=css-clip-path

但是您可以使用内联 SVG 来裁剪图像,因为它具有强大的浏览器支持 - http://caniuse.com/#search=inline%20svg

<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 200 200" xml:space="preserve" width="200px">
<defs>
<!--defines the shape to use for clipping-->
<circle id="circle" cx="100" cy="100" r="100" />
</defs>
<clipPath id="clip">
<!--creates the clipping mask from the shape-->
<use xlink:href="#circle" overflow="visible"></use>
</clipPath>
<!--group containing the image with clipping applied-->
<g clip-path="url(#clip)">
<image overflow="visible" width="768" height="432" xlink:href="http://cp91279.biography.com/Leonardo-da-Vinci_A-Divine-Mind_HD_768x432-16x9.jpg"></image>
</g>
</svg>

工作示例 - http://codepen.io/taneleero/pen/BNZjdj

关于css - 如何在IE和Firefox上创建一个 "clip-path"的圆圈?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26742853/

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