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. Advertising

  2. On Sun, 28 Nov 2004 07:23:35 GMT, nutso fasst <> wrote:

    > 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?


    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
    Replace ".invalid" with ".uk" to reply by e-mail.
     
    Michael Winter, Nov 28, 2004
    #2
    1. Advertising

  3. nutso fasst

    nutso fasst Guest

    > 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.


    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. "nutso fasst" <> wrote:

    > Given the font size in pixels it is possible to emulate the max-width
    > property in ems in MSIE 5-6.


    Check the IE7 Extension at
    <http://dean.edwards.name/IE7/compatibility/>, it provides max-width.
     
    Martin Bialasinski, Nov 28, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ram
    Replies:
    6
    Views:
    399
  2. mttc
    Replies:
    2
    Views:
    2,408
    Roedy Green
    Jul 3, 2009
  3. Stéphane Thibaudeau

    Get the size in pixels for a string

    Stéphane Thibaudeau, Mar 29, 2006, in forum: Ruby
    Replies:
    1
    Views:
    90
    Chris Alfeld
    Mar 29, 2006
  4. Ram

    Converting Font-Size To Pixels

    Ram, May 1, 2007, in forum: Javascript
    Replies:
    6
    Views:
    91
    töff
    May 5, 2007
  5. Cartoper

    getting the font size in pixels

    Cartoper, Sep 8, 2007, in forum: Javascript
    Replies:
    4
    Views:
    131
    Thomas 'PointedEars' Lahn
    Sep 8, 2007
Loading...

Share This Page