Font size - Perspective

I’m trying to do dynamic font sizing but it doesn’t seem to change my font. I try this code line:

<html>min(max(16px, 2vw), 8px)</html>

I try to make the maximum size 16px and the minimum size 8px with this line.
Live, my font move like this code line was not there.

Where are you trying to return HTML in Perspective? The only place this can work is within the Markdown component, if you’ve specifically allowed HTML.

What you probably want is to put your min(max()) CSS expression into a style class, and then apply that style class to whatever components you choose.

My unit are still not sizing.

Here is my new class as you proposed.

What do I need to change?

What isn’t working? You can check browser devtools to confirm, but it appears to be returning 8px deliberately:

i think this css expression just doesnt make any sense. A max(16px) inside a min(8px) does not seem right xd
As now with this expression it will always return 8px… How do you want to size it?
min 8px and max 16px?
should look like this:min(max(8px, 2vw), 16px)
or you just use clamp: clamp(8px,2vw,16px)

1 Like