2

The default background-color of the :-webkit-autofill is orange. How to change it?

:-webkit-autofill, input:-webkit-autofill {
    background-color: #fff !important;
}

The above code doesn't work.

Bruce_Wayne
  • 1,564
  • 3
  • 18
  • 41
木士羽
  • 165
  • 1
  • 2
  • 10
  • More info: http://stackoverflow.com/questions/2781549/removing-input-background-colour-for-chrome-autocomplete – Nico O Apr 21 '15 at 13:21

2 Answers2

4

It's not background-color that gets rid of that yellow/orange, it's the box-shadow:

input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 100px #fff inset;
    -moz-box-shadow: 0 0 0 100px #fff inset;
    box-shadow: 0 0 0 100px #fff inset;
}
Mathew Thompson
  • 55,877
  • 15
  • 127
  • 148
0

You cah change the background-color for autofilled inputs using box-shadow

For Firefox you need additionally filter:none.

:-webkit-autofill { /* -webkit also works in firefox here */
    filter:none; /* needed for firefox! */
    box-shadow: 0 0 0 100px rgba(38, 163, 48, 0.212) inset;
}

How and if this works with Safari I don't know.

Tobias Buschor
  • 3,075
  • 1
  • 22
  • 22