Web APIs

CSS Properties and Values API

Checking compatibility...

Register and manage custom CSS properties with type checking, inheritance control, and default values. Enable smooth transitions and animations for custom properties.

Register Custom Property

This example shows how to create a CSS variable that only accepts colors and has a default value, making it more reliable than standard CSS variables.

=
=
=
=
=
=

Output

Click Run to see output...

Animate Custom Property

This example demonstrates how registered CSS properties can smoothly transition between values, creating fluid animations that aren't possible with regular CSS variables.

=
=
=
=
=
=

Output

Click Run to see output...

Property Validation

This example shows how registered properties can automatically check if values are valid, helping you catch and prevent styling errors before they cause visual problems.

=
=
=
=
=
=

Output

Click Run to see output...