Typed color token
@property --brand {
syntax: "<color>";
inherits: true;
initial-value: #0f766e;
}
.btn { background: var(--brand); }
The @property at-rule registers a custom property. You set its syntax type, whether it inherits, and an initial value. Typed properties animate more predictably than plain -- variables.
@property --brand {
syntax: "<color>";
inherits: true;
initial-value: #0f766e;
}@property --brand {
syntax: "<color>";
inherits: true;
initial-value: #0f766e;
}
.btn { background: var(--brand); }@property --pad {
syntax: "<length>";
inherits: false;
initial-value: 8px;
}
.card { transition: --pad .3s; padding: var(--pad); }
.card:hover { --pad: 20px; }@property is a modern CSS at-rule.
Check current browsers before relying on advanced behavior.
Bottom line: Use progressive enhancement. Keep a readable fallback when a browser ignores the at-rule.
Continue with @scope.
CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
3 people found this page helpful