In my first app I’m trying to add two buttons that will allow the user the change the font size of the whole app. After some reading I discovered that I need to control the font size of the root element (html) as all other child elements are using rem (e.g. relative em) in their font size definition. Even though I can do that statically by setting the SASS variable ($font-size-root), I cannot find a way to do that dynamically.
For those interested in this, here is how to do it statically. Edit src/theme/variables.scss and add at the end of it the following line:
$font-size-root: 66.5%;
The default value is 62.5%.
Dynamically, I can do it for specific elements by adding code similar to:
What you are suggesting was my initial thought, but this affects only the text that’s directly under the ion-content section, not headers, buttons or other components. I wanted to change ALL font sizes with a single click, not just a specific element. Btw, the Math.floor should be removed if you are planning to work with rem.