我有以下SVG图形:SVG“填充:网址(#....)”在Firefox
<svg width='36' height='30'>
<defs>
<linearGradient id="normal-gradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" style="stop-color:rgb(81,82,84); stop-opacity:.4"/>
<stop offset="100%" style="stop-color:rgb(81,82,84); stop-opacity:1"/>
</linearGradient>
<linearGradient id="rollover-gradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" style="stop-color:rgb(0,105,23); stop-opacity:.5"/>
<stop offset="100%" style="stop-color:rgb(0,105,23); stop-opacity:1"/>
</linearGradient>
<linearGradient id="active-gradient" x1="0%" y1="0%" x2="0%" y2="100%">
<stop offset="0%" style="stop-color:rgb(0,0,0); stop-opacity:.4"/>
<stop offset="100%" style="stop-color:rgb(0,0,0); stop-opacity:1"/>
</linearGradient>
</defs>
<text x="8" y="25" style="font-size: 29px;" font-family="Arial">hello world</text>
</svg>'
我通过各个之间的CSS和开关设定的text
元件的fill
属性梯度取决于悬停状态。这在Chrome & Safari中效果很好,但在Firefox中,文本不显示。检查元素后,我发现Firefox在我的fill: url(#...)
CSS属性的末尾附加了none
。我尝试使用Firebug删除none
关键字,但Firebug只是删除了整个属性。这是为什么发生?
编辑: 我要指出的是,如果我删除设置fill
属性CSS和硬编码fill
属性为text
元件(未通过在线style
属性),文本正确显示在所有浏览器。
你的真实CSS是什么样的,去那个SVG?至于“没有”的事情,“fill:url(whatever)none”与“fill:url(whatever)”是一样的;都说,如果网址上的东西不可用,那就没有后备,也不应该画任何东西。 – 2013-02-28 06:35:40
@BorisZbarsky谢谢,我没有意识到'没有'指定没有找到第一个资源时会发生什么。 – 2013-02-28 14:45:21