Inspiration

CSS @function Recipes

CSS Function Recipes is an interactive playground for front-end developers exploring native CSS custom functions. Use eight hands-on examples to tune parameters, edit live CSS, and see how @function can replace repeated declarations or JavaScript-generated values.

Features

  • Eight practical recipes cover color mapping, interface density, motion, transforms, shadows, gradients, easing, and fluid scales.
  • Live parameter controls update each preview and result summary as values change.
  • Editable CSS inputs keep the preview and source code synchronized while you experiment.
  • Implementation comparisons show the repeated CSS or JavaScript logic each custom function can replace.
  • Copy-ready output combines the function, properties, inputs, and call sites into a reusable snippet.

How it works

  1. Choose a recipe — open an experiment from the index to explore the technique in context.
  2. Tune the inputs — adjust the controls or edit CSS values and watch the preview respond.
  3. Review the result — connect the visual outcome to the values produced by the function.
  4. Inspect the code — examine the function definition, its call sites, and any required property setup.
  5. Reuse the pattern — copy the live CSS and adapt the variables to your own inter