Hi @steveb,
Considering the number of devices of difference screen sizes, media queries also have drawbacks (in my humble opinion), as you have to try fitting things, in this case, a font-size that will look good in what could be a big range for each breakpoint.
So, my idea was to avoid media queries (if possible) to make different font sizes depending screen size. In fact, I’ve trying to not make many font-size declarations at all.
So, I decided to use the CSS technique: calc(1em + 1vw)
to control font size and responsiveness. We are telling the browser to calculate the result of adding 1em to 1vw.
The theory being, font sizes that respond to the device width should look great on all screens.
Here is the rational of the calculation:
The em
value of the equation is the size that the text size bottoms out at. If, for example, the viewport is 0px
wide, then vw
is 0, but the font-size will still be at least the em (minimal) value.
The vw value controls how responsive you’d like the font-size to be to the viewport width (1vw is 1/100th the width of the viewport). Adding a high vw
will make it quite responsive — huge text on huge screens, tiny text on tiny screens (as you mentioned before).
But you don’t have to use a high value. Just set the vw
value to a number that the font looks good in a very large screen. As you now shrink the viewport, the font should look proportionally good in all screen sizes. At the same time, it will not get any smaller than the em
value.
The stack default is .35em and 1.00vw
. So, the font will not get super small, but will not also grow super big in the large screen.
I chose these as default values, because the text is still readable in an iPhoneSE and looks proportional in a 27" screen. If you want your bottom out value to be bigger in small screens, you might choose 0.85em as your bottom-out value. And if you don’t want it to grow as big with big screens, you could set a value less than 1vw.
Anyway, give it a spin…
I just pushed out v1.1.3 of the Tab Customizer stack, with the responsive font size controls that I mention here.
Cheers,
Ricardo