::grammar-error

Experimental: これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。

::grammar-errorCSS擬似要素で、ユーザーエージェントが文法的に正しくないとしたテキストの区間を示します。

利用できるプロパティ

::grammar-error 擬似要素では、一部の CSS プロパティのみが利用できます。

構文

css
::grammar-error {}

単純な文書の文法チェック

この例では、最終的に対応しているブラウザーでは、フラグの立った文法エラーがあれば、示したスタイルで強調表示されます。

HTML

html
<p>My friends is coming to the party tonight.</p>

CSS

css
::grammar-error {
  text-decoration: underline red;
  color: red;
}

結果

仕様書

Specification
CSS Pseudo-Elements Module Level 4
# selectordef-grammar-error

ブラウザーの互換性

BCD tables only load in the browser

関連情報