Html Safari CSS 字体颜色问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21400182/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Safari CSS Font Color issue
提问by kwan_ah
I'm having a problem with my font color in safari browser on mac book, iphone and ipad. The disable element turn into gray and I want it to retain its original color black. The result in firefox and chrome are okay.
我在 mac book、iphone 和 ipad 上的 safari 浏览器中的字体颜色有问题。禁用元素变成灰色,我希望它保持原来的黑色。firefox 和 chrome 中的结果没问题。
This is my css code:
这是我的 css 代码:
input[disabled], textarea[disabled],
select[disabled='disabled']{
color: #000000 !important;
}
I also tried using color name but he result is the same.
我也尝试使用颜色名称,但结果是一样的。
Thanks for your help!
谢谢你的帮助!
回答by kwan_ah
This is the only solution I found that works on FF, Chrome, Safari and Safari Mobile. Cheers!
这是我发现的唯一适用于 FF、Chrome、Safari 和 Safari Mobile 的解决方案。干杯!
input[disabled], textarea[disabled],
select[disabled='disabled']{
-webkit-text-fill-color: rgba(0, 0, 0, 1);
-webkit-opacity: 1;
color: rgba(0, 0, 0, 1);
background: white;
}
回答by AO_
You could try set it to anything but solid black such as #00001
or #000002
in order to get around the issue as safari tries to override it.
您可以尝试将其设置为纯黑色以外的任何内容,例如#00001
或#000002
以便在 safari 尝试覆盖它时解决该问题。
input[disabled], textarea[disabled],
select[disabled='disabled']{
color: #000001 !important;
}