views:

23

answers:

0

Here's my issue: I need to set the font-size of an element to match the font-size of another element, dynamically (in javascript).

This works fine when the browser isn't zoomed in/out.

When the browser is zoomed out, however, this occures:

window.getComputedStyle(element, null).getPropertyValue('font-size'); // 14px
element.style.fontSize = '14px';
window.getComputedStyle(element, null).getPropertyValue('font-size'); // 12px

So it seems like it tries to compensate for the zooming, and multiply the font-size by the zoom level...

Is there any way around this?