Reputation: 715
When you surf with your browser, you can increase or decrease the font dimension by pressing CTRL + + or CTRL + -.
Is there a way to simulate this operation by code (like javascript)?
I have to put a couple of button on my site to increase or decrease the size but to make it, I have to change dynamically a lot of font-size properties (BODY, INPUT, OPTIONS etc...)
Upvotes: 0
Views: 932
Reputation: 72251
Don't do this. Browser zoom is a feature that:
a couple of button on my site to increase or decrease the size but to make it, I have to change dinamically a lot of font-size properties
What you really want to do is:
em
or %
) everywhere,document.body.style.fontSize
to modify your base size (which other elements will
use as their base size).Specify the body
's font size in relative units too - In this way you can also respect the user's system settings (which every decent website should do).
There's plenty of resources on CSS font scaling around. Here's one:
http://kyleschaeffer.com/best-practices/css-font-size-em-vs-px-vs-pt-vs/
Upvotes: 4