Safari CSS Font Color issue

2019-02-03 06:10发布

问题:

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.

This is my css code:

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!

回答1:

This is the only solution I found that works on FF, Chrome, Safari and Safari Mobile. Cheers!

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;
}


回答2:

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.

input[disabled], textarea[disabled],
select[disabled='disabled']{
    color: #000001 !important;
}