是否有 -moz-mask CSS 属性,例如 -webkit-mask-image?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8414348/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 02:18:14  来源:igfitidea点击:

Is there a -moz-mask CSS property, like -webkit-mask-image?

firefoxcssgradientmask

提问by MALK

It seems -moz-mask-imageis not supported in Firefox.

-moz-mask-imageFirefox似乎不支持。

I am attempting a foreground gradient. I can't use an image as i need the text to be selectable. Does anyone have any ideas for Firefox?

我正在尝试前景渐变。我不能使用图像,因为我需要可以选择文本。有没有人对 Firefox 有任何想法?

This versionworks in chrome and safari

此版本适用于 chrome 和 safari

css:

css:

-webkit-mask-image: -webkit-gradient(linear, left bottom, left top, color-stop(0.16, rgba(0,0,0,0)), color-stop(0.52, rgba(0,0,0,.5)), color-stop(0.77, rgba(0,0,0,1)));

-moz-mask: -moz-gradient(linear, left bottom, left top, color-stop(0.16, rgba(0,0,0,0)), color-stop(0.52, rgba(0,0,0,.5)), color-stop(0.77, rgba(0,0,0,1)));

回答by Paul D. Waite

According to MDN, you can just use maskfor Firefox, as of Firefox 3.5:

根据 MDN,mask从 Firefox 3.5 开始,您可以只用于 Firefox:

However, maskrequires an SVG image to act as the mask. You might be able to base-64 encode your SVG image into your stylesheet, or you can use an SVG image file.

但是,mask需要一个 SVG 图像作为掩码。您可以将SVG 图像进行base-64 编码到样式表中,或者您可以使用 SVG 图像文件。