Get the font size after a browser zoom

0

Firefox, Chrome and Safari all have a zoom function (C-+ and C--) which is really nice. But is there a way to find out what is the generated font-size after the zoom?

Robert Audi

Posted 2010-08-23T08:41:18.390

Reputation: 345

Answers

1

In Firefox, I would just install the NoSquint extension, which (in addition to its other features) can display the current zoom level in the status bar.

njd

Posted 2010-08-23T08:41:18.390

Reputation: 9 743

0

Here is a little dirty trick as copied from: http://www.webdeveloper.com/forum/showthread.php?t=170413

document.emSize=function(pa){
    pa= pa || document.body;
    var who= document.createElement('div');
    var atts= {fontSize:'1em',padding:'0',position:'absolute',lineHeight:'1',visibility:'hidden'};
    for(var p in atts){
        who.style[p]= atts[p];
    }
    who.appendChild(document.createTextNode('M'));
    pa.appendChild(who);
    var fs= [who.offsetWidth,who.offsetHeight];
    pa.removeChild(who);
    return fs;
}

grm

Posted 2010-08-23T08:41:18.390

Reputation: 2 164