Chrome下的輸入框控件如果選擇了保存的自動填充的值,背景顏色將變成黃色並且無法通過css的background屬性修改
事實上有很多方法可以進行這個背景顏色的更改,下面記錄一個簡單的方法
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
-webkit-box-shadow: 0 0 0 68px #393A59 inset;
}
此方法適用於輸入框背景為純色的場景,若要更改文本顏色css的color屬性也不能直接修改,添加屬性
-webkit-text-fill-color: white!important