xpko7w
Last Updated: February 25, 2016
·
11.64K
· javiercr

Change background color for autocompleted inputs in Google Chrome

Google Chrome (and other webkit browsers) change the background color to yellow on autocompleted inputs inside a form.

The most common approach that most people try is something like this:

input:-webkit-autofill {
   background-color: white !important;
}

However the code above does not work. For some reason Google Chrome ignores that CSS rule.

A good workaround for this is this simple hack:

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

No more ugly autocompleted forms :)