简体   繁体   English

面具在Firefox中不起作用

[英]Masks won't work in Firefox

I've the last version of firefox and there are no ways for make the masks working. 我使用的是Firefox的最新版本,没有办法使面具正常工作。 I read all the discussion about this problem, and no one of the solution adopted works. 我阅读了有关此问题的所有讨论,但没有一个解决方案获得通过。

I've assigned an ID to the object too (the file for the mask is an SVG) 我也为对象分配了一个ID(遮罩的文件是SVG)

This is the code 这是代码

<img id="immy" src="http://www.hdwallpapersarena.com/wp-content/uploads/2012/05/22-amazing-landscape.jpg">

css CSS

#immy
{
    -webkit-mask-image: url(cerchio.svg); /*chrome*/
    mask: url(cerchio.svg#cer); /*firefox*/
}

In chrome all works fine, while in FF i see only a full white page (such if the mask covers all the image). 在chrome中,一切正常,而在FF中,我只能看到完整的白页(例如,如果蒙版覆盖了所有图像)。

CSS Masks are an experimental feature currently only implemented in Webkit. CSS Masks是目前仅在Webkit中实现的实验功能。 They aren't currently fully-supported in Firefox, Internet Explorer, or any other non-webkit browser. Firefox,Internet Explorer或任何其他非Webkit浏览器当前不完全支持它们。

Source: http://caniuse.com/#search=mask 资料来源: http : //caniuse.com/#search=mask

Masks are supported in all major browsers (including IE9+) for SVG elements. 所有主要浏览器(包括IE9 +)都支持SVG元素的掩码。 Going that route would give you a far more consistent experience everywhere. 走那条路线将带给您无处不在的一致体验。 See http://jsfiddle.net/jonathansampson/S7ctE/ 参见http://jsfiddle.net/jonathansampson/S7ctE/

<svg width="100" height="100">
    <defs>
        <pattern id="a" patternUnits="userSpaceOnUse" width="100" height="100">
            <image xlink:href="http://i.imgur.com/7Nlcay7.jpg" x="0" y="0" width="100" height="100" />
        </pattern>
    </defs>
    <polygon fill="url(#a)" points="25 0, 50 0, 75 0, 100 25, 100 50, 100 75, 75 100, 50 100, 25 100, 0 75, 0 50, 0 25" />
</svg>

Your firefox version must be 3.5 (1.9.1) or newer. 您的firefox版本必须为3.5(1.9.1)或更高版本。

Check it out more in this link: https://developer.mozilla.org/en-US/docs/CSS/mask 在此链接中查看更多信息: https : //developer.mozilla.org/en-US/docs/CSS/mask

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM