html - 地址自动填充时如何更改输入字段样式

标签 html css google-chrome autofill

我在我的 chrome 浏览器中存储了地址,所以当我填写表格时,我会得到这样的弹出窗口: enter image description here

当我选择一个地址时,输入字段变成蓝色,如下所示: enter image description here

如何更改 CSS,使输入字段不会变蓝。 我已经尝试过以下代码,但没有用:

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 {
  background-color: transparent;
}

最佳答案

当您选择自动填充建议时,您无法进行透明输入,但您可以使用以下 CSS 在自动填充建议后更改输入字段的颜色:

input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active  {
-webkit-box-shadow: 0 0 0 30px white inset !important;
}

并且您可以更改自动填充建议的文本颜色:

input:-webkit-autofill {
-webkit-text-fill-color: yellow !important;
}

关于html - 地址自动填充时如何更改输入字段样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55831693/

相关文章:

javascript - Chrome 中的 "Uncaught TypeError: Illegal invocation"

javascript - ng-repeat,数据更新后不更新表吗?

javascript - Bootstrap : How to set a viewport to lg even if real screen is smaller ("Classic View")

javascript - 适合 100% 窗口大小的 Div 框架

jquery - 无法使用 jquery 覆盖 css 属性

javascript - 强制 div 填充浏览器宽度

python - 如何在 Python/Chromedriver/Selenium 中设置模拟地理位置长/纬度

python - 如何在 selenium 中使用 chrome webdriver 在 python 中下载文件?

javascript - 如何使div两侧的边距保持不变

css - Bootstrap 3 Carousel 仅半响应。诡异的