Turn off Chrome/Safari spell checking by HTML/css

拜拜、爱过 提交于 2019-11-26 15:26:56

问题


Is there a way for a web developer to 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.

There is a CSS instruction for turning off outlining of inputs so I thought that might also exist. I know how a user can do it.

Or, as a user, can I disable it for some particular domain?


回答1:


Yes, there is the HTML5 spellcheck attribute.

<textarea spellcheck="false"> or <input type="text" spellcheck="false">

http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#spelling-and-grammar-checking

Update: This is now supported in the latest versions of all browsers.




回答2:


This works in Safari 7.1 and should work also in others:

<input autocomplete="off" autocorrect="off" autocapitalize="off" 
spellcheck="false"/>

Only spellcheck="false" didn't work.




回答3:


for all elements of a form it is possible and so:

<form spellcheck="false" .. />



回答4:


Regarding outlining of input tags: don't do it, it's a visual cue for users.

But if you must:

#your-input{outline:none;}


来源:https://stackoverflow.com/questions/4524000/turn-off-chrome-safari-spell-checking-by-html-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!