Path: blob/main/files/en-us/web/css/@property/syntax/index.md
6516 views
------{{CSSRef}}{{SeeCompatTable}}
The syntax CSS descriptor is required when using the {{cssxref("@property")}} at-rule and describes the allowable syntax for the property.
Syntax
The following are all valid syntax strings:
Values
A string with a supported syntax as defined by the specification. Supported syntaxes are a subset of CSS types. These may be used along, or a number of types can be used in combination.
"<length>": Any valid {{cssxref("<length>")}} values.
"<number>": Any valid {{cssxref("<number>")}} values.
"<percentage>": Any valid {{cssxref("<percentage>")}} values.
"<length-percentage>": Any valid {{cssxref("<length-percentage>")}} values.
"<color>": Any valid {{cssxref("<color>")}} values.
"<image>": Any valid {{cssxref("<image>")}} values.
"<url>": Any valid {{cssxref("url","url()")}} values.
"<integer>": Any valid {{cssxref("<integer>")}} values.
"<angle>": Any valid {{cssxref("<angle>")}} values.
"<time>": Any valid {{cssxref("<time>")}} values.
"<resolution>": Any valid {{cssxref("<resolution>")}} values.
"<transform-function>": Any valid {{cssxref("<transform-function>")}} values.
"<custom-ident>": Any valid {{cssxref("<custom-ident>")}} values.
"<transform-list>": A list of valid {{cssxref("<transform-function>")}} values.
Formal definition
{{cssinfo}}
Formal syntax
{{csssyntax}}
Examples
Add type checking to --my-color {{cssxref('--*', 'custom property')}}, using the <color> syntax:
Using CSS {{cssxref('@property')}} at-rule:
Using JavaScript {{domxref('CSS.registerProperty')}}:
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}