4 ms·
for those interested this "hack" is in extensive use in Tailwind css to control opacity for a host of color utilities https://tailwindcss.com/docs/opacity https
by swyx 6y ago
for those interested this "hack" is in extensive use in Tailwind css to control opacity for a host of color utilities https://tailwindcss.com/docs/opacity https://tailwindcss.com/docs/opacity
- lights0123 6y agoPure opacity, like your link, doesn't use variables at all—just regular CSS opacity. Background opacity, however, does: https://tailwindcss.com/docs/background-opacity https://tailwindcss.com/docs/background-opacity
- chrismorgan 6y agoThis doesn’t look to be true. Opacity is straight `opacity: 0.5` and the likes (no custom properties involved) and its background and text opacity things use CSS Custom Properties (`--bg-opacity: 1` and `background: rgb(…, …, …, var(--bg-opacity))`), but not this technique which is all about using custom property values containing only whitespace.