关闭chrome浏览器当表单自动填充默认样式=autofill

问题:项目是react框架,引用antd中的input输入框样式,当在input框输入完成时,并未出现,背景黄色样式,当时,当数据走到另一个页面,然后在返回当时输入过的input的地方时,发现,input框自动带有默认样式背景黄.当时百度了很多前端大佬的方法,都没有起作用,最后,发现解决方法:

前提:在做一次政府项目的时候,window6是没有出现此bug的,window10的电脑就会浮现此问题,

方法如下:

把值改到最大,记住最大,很多人吝啬数据,值写了1000px,但是是没用的,值必须往万上加

bug样式分析:

之所以出现这样的样式, 是因为Chrome会自动为input增加如下样式.

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

old-css

解决方式 :

input:-webkit-autofill,
    input:-webkit-autofill:hover,
    input:-webkit-autofill:focus,
    input:-webkit-autofill:active{

box-shadow: 0 0 0px 100000000px #ffffff inset !important;

}

猜你喜欢

转载自www.cnblogs.com/yangxiaozhen001/p/11424867.html