网页中的表单,chrome会默认给自动填充的input表单加上input:-webkit-autofill私有属性
就会变成:
input:-webkit-autofill { background-color: #FAFFBD; background-image: none; color: #000; }
1、纯色背景(添加内阴影)
input:-webkit-autofill { -webkit-box-shadow: 0 0 0px 1000px white inset; border: 1px solid #CCC!important; }
2、不是纯色背景(添加一个display:none的input框,将name取成和使用的input的name一样)
<span style="font-size:14px;"> <input type="text" name="demo1" style="display: none"> <input type="text" name="demo1" autocomplete="off" > </span>
3、当input是passworde时,记住密码之后,所有地方的input都会自动填充。(加上autocomplete="new-password")
<input type="password" class="form-control" autocomplete = 'new-password' name="password" id="password" required>
<input type="text" class="form-control" name="user_email" id="user_email" onmouseenter="$(this).attr('readonly',false)" onmouseleave="$(this).attr('readonly',true)" readonly="readonly" autocomplete="email">