【问题标题】:How can we overwrite user agent stylesheet?我们如何覆盖用户代理样式表?
【发布时间】:2017-02-13 00:21:53
【问题描述】:

我有一个表单,用于保存我的登录凭据。现在 chrome 正在向输入字段显示自己的背景颜色。
我为此做了研究,但没有发现任何东西。
有什么方法可以覆盖仅来自 chrome 的用户代理样式表与 css?

【问题讨论】:

标签: html css sass


【解决方案1】:

是的,您可以像这样更改样式:

/* Change Autocomplete styles in Chrome*/
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus
input:-webkit-autofill, 
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;
  transition: background-color 5000s ease-in-out 0s;
}

关注文章了解更多信息: https://css-tricks.com/snippets/css/change-autocomplete-styles-webkit-browsers/

【讨论】:

    猜你喜欢
    • 2012-08-21
    • 2015-03-07
    • 2013-12-05
    • 1970-01-01
    • 2011-11-19
    • 1970-01-01
    • 2013-02-16
    • 1970-01-01
    • 2016-06-10
    相关资源
    最近更新 更多