Skip to content

自定义属性

进行属性类型检查、设定默认值以及定义该自定义属性是否可以被继承。

css
@property --my-color {
  syntax: "<color>";
  inherits: false;
  initial-value: #c0ffee;
}

示例

描述
syntax类型string。定义自定义属性的类型。
length | number | percentage | length-percentage | color | image | url | integer | angle | time | resolution | transform-list | transform-function | custom-ident (a custom identifier string)
inherits类型boolean。定义自定义属性是否允许继承
initial-value类型符合syntax定义的类型,定义初始值