我遇到了一点小麻烦,我似乎找不到/使用正确的伪类,希望这里有人能告诉我哪一个是正确的。
我的问题是,google chrome有你之前输入到文本输入中的值,这很棒,但如果你点击其中一个建议,我似乎不能正确地设置样式。我的样式在文本输入的所有其他方面都工作得很好,但是当你从chrome的前值列表中选择一个选项时,我的文本输入的背景会变成蓝色,这是我不想要的。我尝试过:active、:visited和其他几个类,但我认为我使用的类不正确。
请找个人帮帮我,我就是找不到合适的东西。
谢谢。
发布于 2020-08-04 23:18:08
对于webkit浏览器,您可以使用-webkit-autofill
input[type="text"]:-webkit-autofill,
input[type="text"]:-webkit-autofill:hover,
input[type="text"]:-webkit-autofill:focus, {
color: blue;
background: red;
}有关更多信息,请查看this article。
发布于 2020-08-04 23:33:17
将其添加到css中,并向其添加所需的样式。
/* Change autocomplete styles in WebKit */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
border: 1px solid green;
-webkit-text-fill-color: green;
-webkit-box-shadow: 0 0 0px 1000px #000 inset;
}请查看this article,了解更多信息。
https://stackoverflow.com/questions/63249716
复制相似问题