“-webkit-text-fill-color"之间的区别和“颜色"? [英] Difference between "-webkit-text-fill-color" and "color"?
问题描述
我想了解 -webkit-text-fill-color
和简单的 color
之间的区别?有什么功能上的区别吗?据我所知,它们完全相同..有什么可以用一个而不是另一个来做的吗?
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
– 此属性允许您指定文本的填充颜色.如果未设置,则将使用 color
属性进行填充.
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.
所以是的,它们是相同的,但是如果两者具有不同的值,-webkit-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-stroke
时根据需要选择不同的颜色,但它会优雅地回退到 color
> 如果 -webkit-text-stroke
不可用(因此 -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.
请注意,截至 2021 年,-webkit-text-fill-color
(可能还有其他带有 -webkit
前缀的属性)不是 必须是基于 WebKit 的浏览器独有的(即它可以在 Firefox 中使用).
Please note that, as of 2021, -webkit-text-fill-color
(and probably other -webkit
prefixed properties) are not necessarily exclusive to WebKit-based browsers (i.e. it works in Firefox).
这篇关于“-webkit-text-fill-color"之间的区别和“颜色"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!