Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-webkit-text-fill-color: transparent; not working in Safari 7.1.7

I have an ul with several li.

I use this id on the ul.

#list {
margin-right: auto;
margin-left: auto;
width:500px;
color:black;
background: -webkit-linear-gradient(#000, #909090);
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
}

The contents of the ul receive a gradient treatment just fine in Chrome but not Safari. In Safari, all of the li are "invisible". If I inspect and then disable the "-webkit-text-fill-color: transparent;", the text will become visible albeit without the gradient (obviously).

Thoughts?

Here is the JSfiddle: https://jsfiddle.net/s96bzcua/

Kind regards,

like image 539
Peter N Avatar asked Jul 08 '15 10:07

Peter N


2 Answers

I had this same issue. Turns out it was due to the display property. For whatever reason, Safari needs the display set to "inline" or "inline-block", but not "inline-flex".

So for me this meant changing From: display: flex; To: display: inline;

like image 162
Parks Avatar answered Sep 20 '22 12:09

Parks


To someone coming to this, just drop -webkit-text-fill-color: transparent; as it's not a standard and is not on a standard track.

Use instead color: transparent and wrap everything in an @supports to prevent color transparent from being used in case background-clip: text is not supported.

Here's an example: https://jsfiddle.net/0oeftdbk/5/

––

As per the 🐛 bug of the gradient not showing clipped inside the text on Safari, it looks like that if it's applied on the parent element and not directly to the children, all the children need to be display: inline or a inherently inline element such as span.

like image 42
Masserra Avatar answered Sep 20 '22 12:09

Masserra