← Back to CSS
48

`@property`: typed and animatable custom properties

Learn how to register CSS variables with `@property` so the browser understands their real type and can animate them reliably in gradients, progress bars, angles and dynamic themes.

📘 Theory

What changes when you register a variable

It is not just another way to declare tokens. It is a way to make them understandable to the rendering engine.

Without registration, values such as `0deg` and `360deg` live inside a string. The browser cannot always build a smooth transition between them.

With `@property`, the variable has a real type. That means the browser can validate and interpolate it more like a native CSS property.

  • `syntax`: defines the expected type, such as `` or ``.
  • `inherits`: decides whether the value should travel through inheritance.
  • `initial-value`: prevents ambiguous states when the variable has not been explicitly set yet.

Minimum viable registration

The most useful way to learn it is with a case you can animate immediately.

Patterns where it really shines

You do not need it for every token in the system, only for the ones that benefit from typing or interpolation.

1

Gradients and angles

With `` you can rotate conic gradients or directional effects without rewriting the full declaration.

2

Progress and metrics

With ``, progress bars, radial charts and partial fills become much easier to animate declaratively.

3

Dynamic themes

With `` or ``, you can create richer variations around hue, intensity or contrast.

When not to overuse it

Registering variables does not replace design judgment.

1

If a variable only exists to reuse a static value, a normal custom property is usually enough.

2

Reserve `@property` for cases that gain something real from typing or animation. That keeps the code clear and preserves the concept for the places where it matters.

🧪 Learn by doing

Example Interactive demo: three registered types Explore how `@property` unlocks hue changes, angular rotation and a progress bar without relying on JavaScript.

🏁 Challenges

Challenge Challenge: register a progress bar Turn `--progress` into a percentage variable and use it to animate the fill.

🧰 Resources

Test

Check your knowledge with a test about CSS.

Test for CSS

What is this?

I'm Cristian Eslava and I sometimes build websites so both you and I can learn and experiment. culTest

I made this in February 2026 to make learning easier for my students. The idea is to learn web development by practicing and to keep expanding the project with new topics, tests and challenges.

It draws inspiration from MDN, W3Schools, CodePen, Manz and many other web development references. I wanted to combine useful theory, runnable examples, challenges and the testing system I had already built for culTest. culTest

If you liked it, if you didn't, or if you want to get in touch, write to me at cristianeslava@gmail.com