chrome表单自动填充去除input黄色背景

方法一:禁用表单自动填充

<!-- 对整个表单的设置 -->
<form autocomplete="off">
<!-- 单独对某个组件设置 -->
<input type="text" autocomplete="off">

 

方法二:通过纯色的阴影覆盖底色

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

 

方法三:通过设置input样式动画

<!-- 99999s 基本上就是一个无限长的时间 
    通过延长增加自动填充背景色的方式, 是用户感受不到样式的变化
-->
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;
    }

 

转自:https://blog.csdn.net/zhangdongxu999/article/details/73741390

posted @ 2019-12-31 08:59  LuoSpider  阅读(177)  评论(0编辑  收藏  举报