Lab 01: CSS Houdini
Overview
Step 1: @property — Registered Custom Properties
/* Unregistered: browser treats as opaque string, can't animate */
:root { --angle: 0deg; }
/* transition: --angle 1s; */ /* WON'T WORK — browser doesn't know it's an angle */
/* @property: tell the browser the TYPE */
@property --angle {
syntax: '<angle>';
inherits: false;
initial-value: 0deg;
}
@property --brand-color {
syntax: '<color>';
inherits: true;
initial-value: #3b82f6;
}
@property --progress {
syntax: '<number>';
inherits: false;
initial-value: 0;
}
@property --gradient-stop {
syntax: '<percentage>';
inherits: false;
initial-value: 0%;
}
/* Now these ARE animatable! */
.animated-gradient {
background: conic-gradient(from var(--angle), blue, purple, blue);
transition: --angle 1s ease;
}
.animated-gradient:hover {
--angle: 180deg; /* smoothly interpolates! */
}Step 2: Syntax Types Reference
Step 3: Animated Conic Gradient
Step 4: Per-Element Animation with inherits: false
Step 5: CSS Typed OM Concept
Step 6: Paint API Concept
Step 7: Houdini Browser Support (2024)
Step 8: Capstone — @property Syntax Generator
Summary
Feature
Syntax
Support
Last updated
