Video yükleniyor...
Video Yüklenemedi
Now CSS has JavaScript's Math.pow(), you could generate fluid font scales in CSS for viewport/container sizes 👀 (watch resize) :where(dd) { --min: calc(17 * pow(1.2, var(--lvl, 0))); font-size: clamp(var(--min), var(--fluid), var(--max)); ✨ } dd:nth-of-type(2) { --lvl: 2; }
121,965 görüntüleme • 2 yıl önce •via X (Twitter)
10 Yorum

Here's the @CodePen link! 🤙 pow() has good support now too 🥊 It's a fun experiment and cool to see it work. You'll likely generate these scales with JavaScript at build time though 😁 More info on that in the next post 👇

This is where the magic comes from 👏 Some clever people over at Clearleft did the Math for us some time back 🙏 Can read about the Math here. I got ChatGPT to give me a hand converting things to an algorithm 😁

Kinda feel like using vw/sw is cleaner. Any benefits by comparison @jh3yy ?

It won't cap. I'd recommend checking the article posted in the thread 💯 The computed value of using something like this will be something like: clamp(1.2rem, 1.04rem + 2.5vi, 2.6rem)

Can't this be achieved without CSS using a fraction of the VW?

This 👇

@jh3yy here's a fork using tweakpane "interval" inputs for min/max ranges, and a "stepper" input for steps. cheers!

Pretty cool!

Fine! You've changed my mind. CSS IS a programming language.

Is this supported on all browsers?
