【发布时间】:2017-06-11 19:34:20
【问题描述】:
这张图片是我从 safari 得到的:
虽然这是我的代码:
来源:
How to Remove WebKit's Banana-Yellow Autofill Background
Remove forced yellow input background in Chrome - 即使它说 chrome 但仍然指向 webkit-autofill
我曾尝试使用 background-color:white !important; 覆盖锁定的 CSS。调试工具显示用户代理样式表背景颜色已被划掉,但颜色仍然没有改变,并且正在使用自定义。
这让我很困惑,我不知道为什么不允许更改用户代理样式表。
【问题讨论】:
-
不要认为您可以覆盖用户代理样式,尤其是标有
!important -
尝试预先使用类来寻址
input,例如input.class { background-color: red !important } -
@DenisTsoi 有什么理由提前解决
input类? -
我相信特异性会有所帮助,但是使用 -webit-box-shadow 可以解决这个问题
-
取决于 :(、
opera和safari不会让您更改 自动填充。firefox、ie和chrome都可以.
标签: javascript html css safari