Spellcheck disable with CSS not HTML

前端 未结 2 816
广开言路
广开言路 2021-01-04 00:31

I want to disable spellchecking in Chrome/Safari using CSS. In HTML spellcheck=\"false\" works but I want to do this in a way that will affect all input fields.

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-04 00:37

    This does not belong to the realm of CSS (which is optional presentational suggestions). It is not about stylistic features of rendering data but about processing data interactively.

    On browsers that support “spell checking” (which may involve grammar and style checks), the HTML attribute spellcheck or the corresponding IDL (DOM) attribute, settable in JavaScript, is effective.

    In practice, those browsers tend to have “spelling checking” enabled by default for textareas only, and as textareas normally contain human language texts, turning it off does not sound useful. It is in any case user-controllable (the user can switch it off or select language).

提交回复
热议问题