Rob*_*Rob 6 css webkit google-chrome autocomplete
我正在尝试更改输入中的自动填充背景颜色。
在线接受的答案似乎是这样的:
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
input:-internal-autofill-selected,
input:-internal-autofill-previewed {
background-color: white !important;
-webkit-box-shadow: 0 0 0 30px white inset !important;
}
Run Code Online (Sandbox Code Playgroud)
这似乎在一种情况下可以接受,即字段已经自动填充时。
这意味着我刷新了浏览器,并且这些字段已经预先填充了用户名/密码。
当我将鼠标悬停在或单击输入时,背景颜色会发生变化。但是,当我什么都不box-shadow做时没有效果,它仍然设置为默认的user agent stylesheet.
input:-internal-autofill-selected {
background-color: rgb(232, 240, 254) !important;
background-image: none !important;
color: rgb(0, 0, 0) !important;
}
Run Code Online (Sandbox Code Playgroud)
我也尝试了一些随机属性但没有成功。
input:-internal-autofill,
input:-internal-autofill:hover,
input:-internal-autofill:focus,
input:-internal-autofill:active,
Run Code Online (Sandbox Code Playgroud)
Chrome 版本 77.0.3865.90(官方版本)(64 位)
根本不知道如何覆盖它。就像它被添加到 css 规则的底部一样,important无法覆盖?
框阴影为我工作尝试下面的代码。您可以根据需要更改阴影颜色。
input:-webkit-autofill {
background-color: transparent !important;
-webkit-box-shadow: 0 0 0 50px white inset;
}
Run Code Online (Sandbox Code Playgroud)