::grammar-error
::grammar-error CSS 伪元素表示用户代理标记为语法不正确的文本片段。
::grammar-error 伪元素遵循所有高亮伪元素共有的特殊继承模型。有关此继承如何工作的更多详细信息,请参阅高亮伪元素继承部分。
允许的属性
在选择器中使用 ::grammar-error 的规则中,只能使用 CSS 属性的一小部分
语法
css
::grammar-error {
/* ... */
}
示例
基本文档语法检查
在此示例中,最终支持的浏览器应使用所示样式突出显示任何标记的语法错误。
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;
}
结果
规范
| 规范 |
|---|
| CSS 伪元素模块 Level 4 # selectordef-grammar-error |
浏览器兼容性
加载中…