Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios 渐变色问题 #22

Open
JslinSir opened this issue Jul 28, 2022 · 0 comments
Open

ios 渐变色问题 #22

JslinSir opened this issue Jul 28, 2022 · 0 comments
Labels
css css

Comments

@JslinSir
Copy link
Owner

问题出现

ios 渐变色 会出现黑色
如下代码:

  background-image: linear-gradient(180deg, rgba(0, 0, 0, 0), 1%, #f6f6f6);

解决

  background-image: linear-gradient(180deg, rgba(246, 246, 246, 0), 1%, #f6f6f6);

产生原因

Safari在渐变中对颜色的处理是同时渐变rgba()中的每一个参数,因此该例子中实际上是在渐变从黑色到颜色,从全透明到不透明。因此,中间出现了灰色。

解决方法

将rgba()中的前三个参数,设置成背景色的颜色值即可。

@JslinSir JslinSir added the css css label Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css css
Projects
None yet
Development

No branches or pull requests

1 participant