如何阻止 Chrome 使我网站的输入框变黄? [英] How do I stop Chrome from yellowing my site's input boxes?

查看:38
本文介绍了如何阻止 Chrome 使我网站的输入框变黄?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在表单提交、验证后的其他文本和视觉辅助工具中,我将输入框涂成红色以表示需要注意的交互区域.

Among other text and visual aids on a form submission, post-validation, I'm coloring my input boxes red to signify the interactive area needing attention.

在 Chrome(以及 Google 工具栏用户)上,自动填充功能会将我的输入表单重新着色为黄色.这是一个复杂的问题:我希望在我的表单上允许自动完成,因为它可以加快用户登录的速度.如果/当触发错误时,我将检查是否能够将自动完成属性关闭,但它是一个复杂的一些编码以编程方式关闭页面上单个受影响输入的自动完成.简而言之,这将是一个令人头疼的问题.

On Chrome (and for Google Toolbar users) the auto-fill feature re-colors my input forms yellow. Here's the complex issue: I want auto-complete allowed on my forms, as it speeds users logging in. I am going to check into the ability to turn the autocomplete attribute to off if/when there's an error triggered, but it is a complex bit of coding to programmatically turn off the auto-complete for the single affected input on a page. This, to put it simply, would be a major headache.

所以为了避免这个问题,有没有更简单的方法可以阻止 Chrome 重新着色输入框?

So to try to avoid that issue, is there any simpler method of stopping Chrome from re-coloring the input boxes?

[edit] 我尝试了下面的 !important 建议,但没有效果.我还没有检查过 Google 工具栏,看看 !important 属性是否适用于此.

[edit] I tried the !important suggestion below and it had no effect. I have not yet checked Google Toolbar to see if the !important attribute would work for that.

据我所知,除了使用自动完成属性(这似乎确实有效)之外,没有任何其他方法.

As far as I can tell, there isn't any means other than using the autocomplete attribute (which does appear to work).

推荐答案

我知道在 Firefox 中您可以使用属性 autocomplete="off" 来禁用自动完成功能.如果这在 Chrome 中有效(尚未测试),您可以在遇到错误时设置此属性.

I know in Firefox you can use the attribute autocomplete="off" to disable the autocomplete functionality. If this works in Chrome (haven't tested), you could set this attribute when an error is encountered.

这可以用于单个元素

<input type="text" name="name" autocomplete="off">

...以及整个表单

<form autocomplete="off" ...>

这篇关于如何阻止 Chrome 使我网站的输入框变黄?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆