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?

    Thanks,
    nf
     
    nutso fasst, Nov 28, 2004
    #1
    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.

    Mike
     
    Michael Winter, Nov 28, 2004
    #2
    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 (www.svendtofte.com/code/max_width_in_ie/), 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.

    nf
     
    nutso fasst, Nov 28, 2004
    #3
  4. Check the IE7 Extension at
    <http://dean.edwards.name/IE7/compatibility/>, it provides max-width.
     
    Martin Bialasinski, Nov 28, 2004
    #4
    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.