共计 1080 个字符,预计需要花费 3 分钟才能阅读完成。
在解决 ios 中 input 字体色彩时,碰到设置 input 为 disabled 后,字体色彩和 placeholder 字体色彩问题,原本在 iOS14 中设置完没问题,后果在 ios11 中,发现没失效,猜想可能是 iOS 低版本的问题,不过最终还是解决了,奉上代码,供大家应用:
input { | |
background: none; | |
outline: none; | |
border: 0px; | |
font-size: 16px; | |
font-family: PingFangSC-Semibold, PingFang SC; | |
font-weight: 600; | |
color: #1f1f1f; | |
-webkit-user-select: auto; // 设置 ios 下 input 能够选中输出 | |
} | |
input::-webkit-input-placeholder, | |
input:disabled::-webkit-input-placeholder, | |
input[disabled]::-webkit-input-placeholder { | |
font-size: 14px; | |
font-family: PingFangSC-Medium, PingFang SC; | |
font-weight: 500; | |
color: #9f9f9f; | |
-webkit-text-fill-color: #9f9f9f; | |
} | |
input::-moz-placeholder, | |
input:disabled::-webkit-input-placeholder, | |
input[disabled]::-webkit-input-placeholder { | |
font-size: 14px; | |
font-family: PingFangSC-Medium, PingFang SC; | |
font-weight: 500; | |
color: #9f9f9f; | |
-webkit-text-fill-color: #9f9f9f; | |
} | |
input::-ms-input-placeholder, | |
input:disabled::-webkit-input-placeholder, | |
input[disabled]::-webkit-input-placeholder { | |
font-size: 14px; | |
font-family: PingFangSC-Medium, PingFang SC; | |
font-weight: 500; | |
color: #9f9f9f; | |
-webkit-text-fill-color: #9f9f9f; | |
} | |
input:disabled, | |
input[disabled] { | |
-webkit-text-fill-color: #1f1f1f; | |
opacity: 1; | |
} |
正文完