Removing input background colour for Chrome autocomplete?

前端 未结 30 1963
失恋的感觉
失恋的感觉 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:25

    In addition to this:

    input:-webkit-autofill{
    -webkit-box-shadow: 0 0 0px 1000px white inset;
    }
    

    You might also want to add

    input:-webkit-autofill:focus{
    -webkit-box-shadow: 0 0 0px 1000px white inset, 0 0 8px rgba(82, 168, 236, 0.6);
    }
    

    Other wise, when you click on the input, the yellow color will come back. For the focus, if you are using bootstrap, the second part is for the border highlighting 0 0 8px rgba(82, 168, 236, 0.6);

    Such that it will just look like any bootstrap input.

提交回复
热议问题