Ask Felgall Home page
Your host:
Stephen Chapman
Stephen Chapman

Changing Font Sizes

Question: I am working as a web developer. I have one problem with javascript. Could you please help me. My problem is that using the command I want to change the browser font size but it is not working. Actually I had done the program but by using that I can change only the body size but I want to change the browser text size to larger.
Anonymous

Answer: To change the font size used on the whole web page you would use the following Javascript statement:

document.getElementsByTagName('body')[0].style.fontSize = '20px';

To change it for just the section having a specific id (eg. thissec)

document.getElementById('thissec').style.fontSize = '12px';

Related Articles

go to top

FaceBook Follow
Twitter Follow
Donate
Copyright © Felgall Pty Ltd