A.E.Veltstra
March 8, 2003
Use this javascript technique to allow your visitors to change the font size of your web pages, even in stubborn browsers.
Problem
The world's most distributed web browser refuses to allow a visitor to change the font size on the visited web page.
Solution
A script as used by this page. Copy it to your own web server and add it to your web pages. Adapt your style sheets (see below).
Why does it work?
Because we specified 2 kinds of rules for the letter heights in our style sheet:
- In the body class, the font height is set to 11 points;
- Everywhere else, the font size is set to a relative size.
Note
On iPad and possibly other mobile platforms that know zooming, scaling the font has an unexpected paradoxically opposite effect: it causes the page to zoom in or out.
Test it yourself:
Need problem solving?
Talk to me. Let's meet for coffee or over lunch. Mail me at “omegajunior at protonmail dot com”.