Autocomplete is a fantastic feature that is quite useful for long forms, but it isn’t supported consistently across every browser. I wouldn’t recommend disabling this feature, but it is on occasion necessary.
There is conflicting information out there about how to do the styling of auto-completed form fields and how exactly to disable the feature. Chrome has changed it’s support of styling and the autocomplete attribute several times over the last couple years so there is a lot of outdated info.
For styling there are a couple CSS properties that can’t be styled how you would normally style them. The properties “color” and “background” aren’t styleable in Chrome because of how the browser applies the CSS to the field. You will first need to use the pseudo class :-webkit-autofill on the field type you wish to style, and then set a inset box shadow that will overlay the background color. If you want any kind of transparency or a background image in the field, good luck, because there is no way to do this at the moment.
Here is an example of how to style the background.
-webkit-box-shadow: 0 0 0 1000px white inset;
box-shadow:0 0 0 1000px white inset;
As for controlling text color, you will need to use the text-fill-color property instead of the color property.
Disabling autocomplete is a bit trickier. Most browsers support the form and input attribute which should normally look like this:
If a lot of your users are coming from browsers other than Chrome, you should be able to use the attribute for most major fields. Unfortunately, Chrome doesn’t support it at all if a user has autocomplete enabled in their settings (this is a default setting). The only way to turn it off in Chrome is by tricking the browser by using an unsupported value. For example:
It’s regrettable that Chrome doesn’t support the w3 recommended usage of this attribute. If you want it disabled you will have to make a choice about what browsers you want it disabled in. For full support details check it out, here.
I hope this has been helpful!