get font size in pixels - IE

Discussion in 'Javascript' started by nutso fasst, Nov 28, 2004.

  1. nutso fasst

    nutso fasst Guest

    window.getComputedStyle() is no good in MSIE. Is there a way to determine
    the pixel size of the default (or user-specified) font for BODY in IE?

    nutso fasst, Nov 28, 2004
    1. Advertisements

  2. objRef.currentStyle.<property>

    gives you the equivalent. However, why do you need to know the font size?
    Just use em units where 1em equals the height of the font.

    Michael Winter, Nov 28, 2004
    1. Advertisements

  3. nutso fasst

    nutso fasst Guest

    Given the font size in pixels it is possible to emulate the max-width
    property in ems in MSIE 5-6. That's what I want to do. It's possible to
    emulate max-width for the general case of 96 pixels/inch display and 12pt
    default font size (, but I was
    hoping to do better. Maybe the numerical value could be separated from the
    units in the fontSize property, multiplied by max-width in ems, then
    appended with original units as the max-width property, but since it's
    possible font-size might be "medium" or "90%" or "larger" on a user's
    stylesheet, that won't work in all cases.

    nutso fasst, Nov 28, 2004
  4. Check the IE7 Extension at
    <>, it provides max-width.
    Martin Bialasinski, Nov 28, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.