css-creating
css-creating copied to clipboard
避免使用 CSS-wide keywords
CSS 规范中定义了一些保留关键字,我们应该在 <custom-ident> 中避免使用这些值。历史遗留原因,虽然当前某些浏览器支持这些值,但在将来可能会禁用,这会导致相关 CSS 失效。
TODO: CSS 示例
详见:
- https://github.com/w3c/csswg-drafts/issues/7170
- https://github.com/w3c/csswg-drafts/issues/7439
这些关键字当前散落在不同的规范,包括:
css-values-4
https://www.w3.org/TR/css-values-4/#common-keywords
Defined:
-
initial -
inherit -
unset
css-cascade-4
https://drafts.csswg.org/css-cascade/#defaulting-keywords
Defined:
-
initial -
inherit -
unset -
revert
css-cascade-5
https://drafts.csswg.org/css-cascade-5/#revert-layer
Defined:
-
initial -
inherit -
unset -
revert -
revert-layer
css-values-4
https://www.w3.org/TR/css-values-4/#ref-for-css-wide-keywords
The CSS-wide keywords are not valid
<custom-ident>s. Thedefaultkeyword is reserved and is also not a valid<custom-ident>
There is a default keyword.