Decreased Value for Clamp According to Ratio

60 Views Asked by At

I have a clamp with a min viewport of 430 and max viewport of 1920, I'm trying to figure out what my minimum value would be at 150px viewport according to this ratio clamp(2rem, 11.678vw + -1.138rem, 12.875rem)

1

There are 1 best solutions below

2
Grzegorz Adam Kowalski On

If your clamp calculation is made for minimum viewport 430px then viewport 150px is less than that so it should result in 2rem. I've looked at the online calculator you mentioned in the comments. It assumes 1rem to be equal to 16px, so in fact your calculation is the same as:

clamp(32px, 11.678vw - 18.215px, 206px)

And so the resulting value for 150px viewport would be 32px (as expected as 2rem = 32px). And it is so - I've checked it by implementing it in the code and using devtools to inspect the value for proper viewport width.