Chrome浏览器记住密码后input框黄色背景且背景图片不显示的问题

本文介绍了解决Chrome浏览器自动填写表单后输入框背景变黄及字体颜色变化的方法,包括通过阴影覆盖、延迟自动填充时间以及关闭自动填充功能等方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Chrome浏览器记住密码后再进入登录页后,输入框背景颜色变为黄色,字体颜色变成#000黑色,且添加的背景图片也那不显示了,进入审查元素后,发现浏览器默认给输入框添加了样式,并且无法通过important修改

input:-webkit-autofill, textarea:-webkit-autofill, select:-webkit-autofill {
    background-color: rgb(250, 255, 189);
    background-image: none;
    color: rgb(0, 0, 0);
}

 解决方法:

1.如果没有设置背景图片-通过白色阴影覆盖黄色,并设置字体颜色

input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px #fff inset !important;/*白色*/
     -webkit-text-fill-color: #323333;/*字体颜色*/
}

或通过延迟自动填充的时间

input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus,
    input:-webkit-autofill:active {
        -webkit-transition-delay: 99999s;
        -webkit-transition: color 99999s ease-out, background-color 99999s ease-out;
    }

 

2.有背景图片

第一种:通过autocomplete="off"关闭浏览器自带填充表单功能

第二种:背景图片不写在input里,利用absolute置于input框上

<div class="inputWrap">
    <span class="userLabel"></span>
    <input placeholder="用户名" type="text" id="username" name="username">
</div>

  

 

转载于:https://www.cnblogs.com/web520/p/7278654.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值