简体   繁体   English

css 渐变文字在 Safari 上不可见

[英]css gradient text are not visible on Safari

am facing one issue on gradient css on web and android devices text are visible but on Safari its not showing at all.我在 web 和 android 设备上的渐变 css 上面临一个问题,但在 Z50DE9BC68C93DC32D8C7C909 上完全不显示其文本。 Please have look on both the screen shots.请看两个屏幕截图。

I've checked with caniuse.com, and both -webkit-text-fill-color and background-clip: text are said to be supported both in Safari/Desktop as well as Safari/iOS.我已经检查了 caniuse.com,并且-webkit-text-fill-colorbackground-clip: text

 .gradient-effect { background: linear-gradient(240.86deg, #ff8329 0%, #ff007a 66.41%); -webkit-text-fill-color: transparent; width: max-content; background-clip: text; -webkit-background-clip: text; }.mine-box-title { font-family: Poppins; font-style: normal; font-weight: bold; font-size: 40px; line-height: 44px; display: flex; align-items: center; letter-spacing: -0.01em; }
 <h2 class="mine-box-title gradient-effect">25 MILLION</h2>

在此处输入图像描述

在此处输入图像描述

There is an unresolved, open issue about this on the WebKit Bugzilla since 2017: background-clip:text doesn't work with display:flex .自 2017 年以来,WebKit Bugzilla 上有一个未解决的未解决问题: background-clip:text 不适用于 display:flex Apple has ignored this bug for 4 years, it will probably never be resolved.苹果已经忽略了这个漏洞 4 年,它可能永远不会得到解决。

Remove display: flex and it works:删除display: flex并且它可以工作:

 .gradient-effect { background: linear-gradient(240.86deg, #ff8329 0%, #ff007a 66.41%); -webkit-text-fill-color: transparent; width: max-content; background-clip: text; -webkit-background-clip: text; }.mine-box-title { font-family: Poppins; font-style: normal; font-weight: bold; font-size: 40px; line-height: 44px; letter-spacing: -0.01em; }
 <h2 class="mine-box-title gradient-effect">25 MILLION</h2>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM