if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {$(window).load(function(){$('input:-webkit-autofill').each(function(){var text = $(this).val();var name = $(this).attr('name');$(this).after(this.outerHTML).remove();$('input[name=' + name + ']').val(text);});});}
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;}
/* Change the white to any color */input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus,input:-webkit-autofill:active{-webkit-box-shadow: 0 0 0 30px white inset !important;}
此外,您可以使用它来更改文本颜色:
/*Change text in autofill textbox*/input:-webkit-autofill{-webkit-text-fill-color: yellow !important;}
/* For removing autocomplete highlight color in chrome (note: use this at bottom of your css file). */
input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus,input:-webkit-autofill:active {transition: all 5000s ease-in-out 0s;transition-property: background-color, color;}
(function($){if (navigator.userAgent.toLowerCase().indexOf("chrome") >= 0) {$('input, select').on('change focus', function (e) {setTimeout(function () {$.each(document.querySelectorAll('*:-webkit-autofill'),function () {var clone = $(this).clone(true, true);$(this).after(clone).remove();updateActions();})}, 300)}).change();}var updateActions = function(){};// method for update input actionsupdateActions(); // start on load and on rebuild})(jQuery)
*:-webkit-autofill,*:-webkit-autofill:hover,*:-webkit-autofill:focus,*:-webkit-autofill:active {/* use animation hack, if you have hard styled input */transition: all 5000s ease-in-out 0s;transition-property: background-color, color;/* if input has one color, and didn't have bg-image use shadow */-webkit-box-shadow: 0 0 0 1000px #fff inset;/* text color */-webkit-text-fill-color: #fff;/* font weigth */font-weight: 300!important;}
input:-webkit-autofill,textarea:-webkit-autofill,select:-webkit-autofill {-webkit-box-shadow: 0 0 0 1000px #d500ff inset !important;/*use inset box-shadow to cover background-color*/-webkit-text-fill-color: #ffa400 !important;/*use text fill color to cover font color*/}
input:-webkit-autofill {border: none;border-radius: .3rem;caret-color: #fff; /* Pour le I quand on édite */color: #fff;background: #292a2d;/* webkit autofill */-webkit-text-fill-color: #fff; /* Surcharge la font color d'autofill */-webkit-background-clip: text; /* Supprime le background autofill, utile pour le border radius */box-shadow: 0 0 0 50px #292a2d inset; /* Ajoute un fake background à base d'ombrage aplatit */}