I'm trying to understand the difference between -webkit-text-fill-color
and just simply color
? Is there any functional difference? So far as I can tell, they're exactly the same.. Is there something you could do with one but not the other?
我试图理解-webkit-text-fill-color和简单颜色之间的区别?有任何功能差异吗?据我所知,它们完全一样。你能用一种而不是另一种吗?
2 个解决方案
#1
21
From the WebKit blog:
来自WebKit博客:
text-fill-color
– This property allows you to specify a fill color for text. If it is not set, then thecolor
property will be used to do the fill.text-fill-color - 此属性允许您指定文本的填充颜色。如果未设置,则将使用color属性进行填充。
So yes, they are the same, but -webkit-text-fill-color
will take precedence over color
if the two have different values.
所以是的,它们是相同的,但是如果两者具有不同的值,则-webkit-text-fill-color将优先于颜色。
I think the rationale for this is that you can choose a different color if you want when using -webkit-text-stroke
, but it will gracefully fall back to color
if -webkit-text-stroke
isn't available (and thus -webkit-text-fill-color
isn't either). There may be cases where you would otherwise end up with unreadable text.
我认为这样做的理由是,如果你想在使用-webkit-text-stroke时可以选择不同的颜色,但如果-webkit-text-stroke不可用,它将优雅地回归到颜色(因此-webkit -text-fill-color也不是)。在某些情况下,您可能会以不可读的文本结束。
#2
21
-webkit-text-fill-color
can be set to transparent
which allows you to do some really interesting things on text, like setting a horizontal gradient. Check out this rainbow text example: http://jsfiddle.net/DoubleYo/qGfzm/
-webkit-text-fill-color可以设置为透明,允许你在文本上做一些非常有趣的事情,比如设置水平渐变。看看这个彩虹文本示例:http://jsfiddle.net/DoubleYo/qGfzm/
#1
21
From the WebKit blog:
来自WebKit博客:
text-fill-color
– This property allows you to specify a fill color for text. If it is not set, then thecolor
property will be used to do the fill.text-fill-color - 此属性允许您指定文本的填充颜色。如果未设置,则将使用color属性进行填充。
So yes, they are the same, but -webkit-text-fill-color
will take precedence over color
if the two have different values.
所以是的,它们是相同的,但是如果两者具有不同的值,则-webkit-text-fill-color将优先于颜色。
I think the rationale for this is that you can choose a different color if you want when using -webkit-text-stroke
, but it will gracefully fall back to color
if -webkit-text-stroke
isn't available (and thus -webkit-text-fill-color
isn't either). There may be cases where you would otherwise end up with unreadable text.
我认为这样做的理由是,如果你想在使用-webkit-text-stroke时可以选择不同的颜色,但如果-webkit-text-stroke不可用,它将优雅地回归到颜色(因此-webkit -text-fill-color也不是)。在某些情况下,您可能会以不可读的文本结束。
#2
21
-webkit-text-fill-color
can be set to transparent
which allows you to do some really interesting things on text, like setting a horizontal gradient. Check out this rainbow text example: http://jsfiddle.net/DoubleYo/qGfzm/
-webkit-text-fill-color可以设置为透明,允许你在文本上做一些非常有趣的事情,比如设置水平渐变。看看这个彩虹文本示例:http://jsfiddle.net/DoubleYo/qGfzm/