Interpolating Numeric CSS Variables | CSS-Tricks
[ad_1] We can make variables in CSS pretty easily: :root { –scale: 1; } And we can declare them on any element: .thing { transform: scale(–scale); } Even better for an example like this is applying the variable on a user interaction, say :hover: :root { –scale: 1; } .thing { height: 100px; transform: scale(–scale); width: 100px; } .thing:hover { –scale: 3; } CodePen Embed Fallback But if we wanted