通过 HTML/css 关闭 Chrome/Safari 拼写检查
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4524000/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Turn off Chrome/Safari spell checking by HTML/css
提问by tillda
Is there a way for a web developerto turn off Chrome/Safari/WebKit's spellchecking on particular input
or textarea
elements? I mean either by special tag attribute or a proprietary CSS instruction.
Web 开发人员有没有办法关闭 Chrome/Safari/WebKit 对特定元素input
或textarea
元素的拼写检查?我的意思是通过特殊的标签属性或专有的 CSS 指令。
There is a CSS instruction for turning off outlining of input
s so I thought that might also exist. I know how a user can do it.
有一个关闭input
s大纲的 CSS 指令,所以我认为这也可能存在。我知道用户如何做到这一点。
Or, as a user, can I disable it for some particular domain?
或者,作为用户,我可以为某些特定域禁用它吗?
回答by Gaurav
Yes, there is the HTML5 spellcheck attribute.
是的,有 HTML5 拼写检查属性。
<textarea spellcheck="false">
or <input type="text" spellcheck="false">
<textarea spellcheck="false">
或者 <input type="text" spellcheck="false">
Update: This is now supported in the latest versions of all browsers.
更新:现在所有浏览器的最新版本都支持此功能。
回答by Timo K?hk?nen
This works in Safari 7.1 and should work also in others:
这适用于 Safari 7.1,也适用于其他:
<input autocomplete="off" autocorrect="off" autocapitalize="off"
spellcheck="false"/>
Only spellcheck="false"
didn't work.
只是spellcheck="false"
没有用。
回答by MTM
for all elements of a form it is possible and so:
对于表单的所有元素,它都是可能的,因此:
<form spellcheck="false" .. />
回答by Camilo Martin
Regarding outlining of input tags: don't do it, it's a visual cue for users.
关于输入标签的概述:不要这样做,这是用户的视觉提示。
But if you must:
但如果你必须:
#your-input{outline:none;}
回答by Paul Razvan Berg
In React, you gotta use spellCheck
instead.
在 React 中,你必须使用它spellCheck
。
<input spellCheck={false} type="text"/>