~/talk

CSS Variable Secrets

Talkat CSS Day 2022 · 2022-06-09..06-10· [css]
slides:none on file

Most teams treat CSS custom properties as constants but metrics from the Web Almanac show roughly two‑thirds of usages have zero variable depth, so deeper patterns matter. Demos register properties via CSS @property / css.registerProperty to enable smooth hue animation, inherit true lengths, and coerce integers; pragmatic techniques include space toggle to turn whole declarations off, the counter trick to print numbers, and linear range mapping to map 0–1 inputs to colors and geometry. Examples (buttons, rainbow hover, bar chart, speech bubble) work where browser support exists and fall back where it doesn’t.

AI-written summary · about

  1. 0:00Start
  2. 8:38CSS variables are just regular properties
  3. 11:48Pseudo-private variables succinctly reduce fallback duplication
  4. 12:59CSS Variables allow us to create a higher level styling API
  5. 16:23CSS variables cannot be interpolated
  6. 19:18@property-defined initial values take precedence over var() fallback
  7. 38:08Use variables for pure data, not CSS values
  8. 39:51content only accepts strings. You can convert numbers to strings via counter-reset.
  9. 41:51Convert a number to an integer by assigning it to a property registered as "" inside calc()
  10. 47:08Linear mapping allows the same variable to control multiple things, continously or discretely
  11. 49:27Range mapping allows you to decouple input from output
  12. 51:56Relative values inherit as syntax tokens unless the property is registered
  13. 55:22The syntax of registered properties is only checked at computed value time.
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.