chrome表单自动填充后,input文本框的背景会变成黄色的,这是因为chrome会默认给自动填充的input表单加上input:-webkit-autofill私有属性,填充了下面的样式:
input:-webkit-autofill {
background-color: #FAFFBD;
background-image: none;
color: #000;
}
查看了很多资料:有两种解决方案,暂时
第一种:适用于纯色背景
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px white inset;
border: 1px solid #CCC!important;
}
第二种:有背景图的
input:-webkit-autofill
{ -webkit-animation: autofill-fix 1s infinite; }
@-webkit-keyframes autofill-fix
{
from { background-color: transparent }
to { background-color: transparent }
}
意思是让颜色永远在transparent到transparent进行循环动画。
有人说:在form标签上直接关闭了表单的自动填充功能:autocomplete=”off”。亲测无效,大概是浏览器升级了,总之是没有效果的。大概就是这些了,高手指教请留言评论!