...

View Full Version : Getting font size



Kaastosti
04-10-2003, 12:05 PM
I have a page, which gets its font size from a CSS file. In this file, it's set for 80%. I'm creating a side menu, which is going great so far, except that I want it to have variable width and height according to the font size set in the browser.

I.E. If you set the font size in Explorer to 'Large', the menu's should be larger to fit the font in. The same goes for small. Since the menu itself was, by origin, 100% static with a width and height that could not be changed, this will take some effort in going through the code.

If I can get the correct font size (or height & width in pixels), I can complete the menu :) Is there any function built within JavaScript which can do such a thing or, of not, is there a script available that does a thing like that?

Thx in advance!

Weirdan
04-10-2003, 12:46 PM
You can express menu size in ems. em is measurement relative to font-size.

Kaastosti
04-10-2003, 12:54 PM
But how? If I simply change the 'px' to 'em', things get huuuge. If I then, logically, set all sizes to 1 or 2, the entire menu goes bazerk :P

I have 2 JavaScript files:
1. Holds all 'real' programming for the menu, including 'px'
2. Holds all variables and menu structure (items and submenu's)

I change px in file 1 to em
I change sizes to 1 or 2 in file 2

brothercake
04-10-2003, 12:57 PM
em is based on the size of an "m" character at the contextual font size. So, if your font size is "1em" this maps to roughly 13 pixels.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum