CSS ::grammar-error Pseudo-element

Definition and Usage

CSS ::grammar-error Pseudo-elements are used to set the style of the text marked as a syntax error by the browser.

Note:The following properties can be used with ::grammar-error Used together:

  • color
  • background-color
  • cursor
  • caret-color
  • outline
  • text-decoration
  • text-emphasis-color
  • text-shadow

Example

Set the style of the text marked as a syntax error by the browser:

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

Try it yourself

CSS Syntax

::grammar-error {
  css declarations;

Technical details

Version: CSS Pseudo-elements Module Level 4

Browser support

The numbers in the table specify the first browser version that fully supports this pseudo-element.

Chrome Edge Firefox Safari Opera
121 121 Not supported 17.4 107

Related pages

Tutorial:CSS Pseudo-element