项目中做登录页面,记住了账号名和密码,在chrome浏览器中自动填充了黄色的背景,我需要背景为透明。找了一些人的方案,没行得通,最后终于找到一个处理方案。
方案一:背景可以为有颜色的时候(比如白色)
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px white inset;
}
方案二:设置背景颜色为透明
input:-webkit-autofill {
-webkit-text-fill-color: #999999 !important;
transition: background-color 5000s ease-in-out 0s;
}
#999999是我填充的字体的颜色,可以根据需要更改。也是借鉴别人的,在我的项目里亲测能用。