Text Widget - Font Size Unit: rem vs vw?

321
2
Jump to solution
11-27-2023 02:20 AM
xingchenc
Occasional Contributor

Can someone explain to me what is the expected behavior if I choose "rem" as the font size unit in the text widget? To my understanding, "rem" works in pair with "root html font size", does this mean we can also set the root html font size for my app in the Experience Builder? Or it's a set value by esri and we can not change it?

xingchenc_0-1701080325239.png

If I'm buidling a responsive webpage, I will use the "vw" as the font size unit since it can autoscale the text size accroding to the browser page size. (As shown below)

xingchenc_0-1701080620781.png

xingchenc_1-1701080748544.pngxingchenc_2-1701080760109.png

So back to the question, what can I achieve if I choose "rem" as the font size unit?

 

 

 

0 Kudos
1 Solution

Accepted Solutions
JeffreyThompson2
MVP Regular Contributor

rem calculates a font size based on the standard font size of the page, where 1rem is the standard font size, 2rem is twice the font size and 0.5rem is half the standard size, etc. So, if the standard size is 16pt, 2rem would be 32pt and 0.5rem would be 8pt. These sizes are not necessarily affected by resizing the screen, but the root value might change if the screen size crossed one of the breakpoint sizes causing the effective size to recalculate. You may be able to change the default size with the font size slider in the theme settings, but this is such a blunt tool that I wouldn't recommend changing this setting at all.

vw stands for visual width. 1vw means that a character will take up 1% of the width of the browser window and this will change anytime the width of the screen is altered. Depending on what you are trying to do, this could be a good thing or a bad thing. If you have some very important text that you want to be the center of attention at all times, using vw could be an excellent option. But in many cases, it is hard to design around the constantly changing size of vw text.

GIS Developer
City of Arlington, Texas

View solution in original post

0 Kudos
2 Replies
JeffreyThompson2
MVP Regular Contributor

rem calculates a font size based on the standard font size of the page, where 1rem is the standard font size, 2rem is twice the font size and 0.5rem is half the standard size, etc. So, if the standard size is 16pt, 2rem would be 32pt and 0.5rem would be 8pt. These sizes are not necessarily affected by resizing the screen, but the root value might change if the screen size crossed one of the breakpoint sizes causing the effective size to recalculate. You may be able to change the default size with the font size slider in the theme settings, but this is such a blunt tool that I wouldn't recommend changing this setting at all.

vw stands for visual width. 1vw means that a character will take up 1% of the width of the browser window and this will change anytime the width of the screen is altered. Depending on what you are trying to do, this could be a good thing or a bad thing. If you have some very important text that you want to be the center of attention at all times, using vw could be an excellent option. But in many cases, it is hard to design around the constantly changing size of vw text.

GIS Developer
City of Arlington, Texas
0 Kudos
xingchenc
Occasional Contributor

Thank you, this is very thorough.😃

0 Kudos