Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I increase all the font sizes on a page after the page loads?

Is there any way using JavaScript or jQuery to increase all the font sizes on the page by a certain percentage after the page loads?

like image 969
d-_-b Avatar asked Apr 08 '13 01:04

d-_-b


People also ask

What are 3 ways to increase the font size?

To make the texts larger, press “Ctrl + Shift + >”. To make the texts smaller, press “Ctrl + Shift + <”.

How do I increase font size in CSS globally?

click(function() { $("body"). css("fontSize", "120%"); }); Done.


2 Answers

Zoom property will affect all other properties like dimensions. And also it will not be supported in all browsers. best way is to reduce using some jQuery code like follows

$(document).ready(function(){
       $('*').each(function(){
       var k =  parseInt($(this).css('font-size')); 
       var redSize = ((k*90)/100) ; //here, you can give the percentage( now it is reduced to 90%)
           $(this).css('font-size',redSize);  

       });
});
like image 90
Umer Farook Avatar answered Sep 28 '22 12:09

Umer Farook


Would zooming the entire page have the desired affect? (A little different that just increasing the font sizes).

The CSS zoom property is supported by IE 5.5+, Opera, and Safari 4, and Chrome. For Firefox, you can use -moz-transform: scale(2). So to zoom the entire page:

<body style="zoom:2; -moz-transform:scale(2);"> ... </body>
like image 43
dwarring Avatar answered Sep 28 '22 10:09

dwarring