Change font color of autofill input field

前端 未结 3 839
萌比男神i
萌比男神i 2020-12-31 03:08

I\'ve managed to change the background color of an autofilled input field from yellow to white with the following code:

input.login:-webkit-autofill {
    -w         


        
3条回答
  •  礼貌的吻别
    2020-12-31 03:32

    Try the below CSS:

    /* Change Autocomplete styles in Chrome*/
    input:-webkit-autofill,
    input:-webkit-autofill:hover, 
    input:-webkit-autofill:focus
    input:-webkit-autofill, 
    textarea:-webkit-autofill,
    textarea:-webkit-autofill:hover
    textarea:-webkit-autofill:focus,
    select:-webkit-autofill,
    select:-webkit-autofill:hover,
    select:-webkit-autofill:focus {
      border: 1px solid green;
      -webkit-text-fill-color: green;
      -webkit-box-shadow: 0 0 0px 1000px #000 inset;
      transition: background-color 5000s ease-in-out 0s;
    }
    

    We can use the -webkit-autofill pseudo-selector to target those fields and style them as we see fit.

提交回复
热议问题