chrome浏览器自动填充背景色-webkit-autofill

18 篇文章 0 订阅

 输入框在chrome浏览器下显示白色背景,主要针对type为password的input,即使添加了非白色背景,仍然没用,看控制面板会有自动填充:input:-webkit-autofill的 background-color: rgb(250, 255, 189)!important;这个样式

尝试把自动填充关闭:autocomplete="off",仍然没有用。

解决如下:

1、设置box-shadow 用阴影覆盖,这种方法比较适合 纯色背景,不适合透明背景。


input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px rgba(67,118,144,0.5) inset;
}

input:-webkit-autofill {
     -webkit-box-shadow: 0 0 0px 1000px white inset;
     -webkit-text-fill-color: #333;
}

2、延长自动填充背景色的时间,如让颜色填充在“一万年”以后实现,这样短时间就看不到啦:

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

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值