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?
From the WebKit blog:
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.
So yes, they are the same, but -webkit-text-fill-color
will take precedence over color
if the two have different values.
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.
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
is specific to Webkit. Furthermore, the color property extends to borders. If you assign a border to an element with a color
property and not specify the border color, the border will default to the color
property. –
Compute text-fill-color
might be added by all other browsers. I was more so trying to get the rationale of what you would use it for, or how it would benefit someone when it does the same thing as another property. Andrew's rationale seems to make sense. –
Lipoma -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-]background-clip: text
, If you set the color
to transparent and opened it in a non-Webkit browser, the text would be entirely invisible! This lets you use a fallback color
for other browsers that will show on top of the gradient, while letting Webkit continue to be pretty. –
Marinara © 2022 - 2024 — McMap. All rights reserved.
-webkit-text-fill-color
allows the targeting of only Webkit-based browsers, whilecolor
can be used to target the rest. – Elliottellipse