Removing input background colour for Chrome autocomplete?

前端 未结 30 1944
失恋的感觉
失恋的感觉 2020-11-22 04:02

On a form I\'m working on, Chrome is auto-filling the email and password fields. This is fine, however, Chrome changes the background colour to a pale yellow colour.

30条回答
  •  长发绾君心
    2020-11-22 04:15

    A possible workaround for the moment is to set a "strong" inside shadow:

    input:-webkit-autofill {
        -webkit-box-shadow:0 0 0 50px white inset; /* Change the color to your own background color */
        -webkit-text-fill-color: #333;
    }
    
    input:-webkit-autofill:focus {
        -webkit-box-shadow: /*your box-shadow*/,0 0 0 50px white inset;
        -webkit-text-fill-color: #333;
    }  
    

提交回复
热议问题