-
Notifications
You must be signed in to change notification settings - Fork 22.5k
/
index.md
70 lines (48 loc) · 1.36 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
---
title: "::grammar-error"
slug: Web/CSS/::grammar-error
page-type: css-pseudo-element
browser-compat: css.selectors.grammar-error
---
{{CSSRef}}
The **`::grammar-error`** [CSS](/en-US/docs/Web/CSS) [pseudo-element](/en-US/docs/Web/CSS/Pseudo-elements) represents a text segment which the {{glossary("user agent")}} has flagged as grammatically incorrect.
## Allowable properties
Only a small subset of CSS properties can be used in a rule with `::grammar-error` in its selector:
- {{cssxref("color")}}
- {{cssxref("background-color")}}
- {{cssxref("cursor")}}
- {{cssxref("caret-color")}}
- {{cssxref("outline")}} and its longhands
- {{cssxref("text-decoration")}} and its associated properties
- {{cssxref("text-emphasis-color")}}
- {{cssxref("text-shadow")}}
## Syntax
```css
::grammar-error {
/* ... */
}
```
## Examples
### Simple document grammar check
In this example, eventual supporting browsers should highlight any flagged grammatical errors with the styles shown.
#### HTML
```html
<p contenteditable spellcheck="true">
My friends is coming to the party tonight.
</p>
```
#### CSS
```css
::grammar-error {
text-decoration: underline red;
color: red;
}
```
#### Result
{{EmbedLiveSample('Simple_document_grammar_check', '100%', 60)}}
## Specifications
{{Specifications}}
## Browser compatibility
{{Compat}}
## See also
- {{cssxref("::spelling-error")}}