473,790 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

get font size in pixels - IE

window.getCompu tedStyle() 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
Jul 23 '05 #1
4 2466
On Sun, 28 Nov 2004 07:23:35 GMT, nutso fasst <no********@no. where> wrote:
window.getCompu tedStyle() 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.currentS tyle.<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.
Jul 23 '05 #2
> objRef.currentS tyle.<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
Jul 23 '05 #3
"nutso fasst" <no********@no. where> 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.na me/IE7/compatibility/>, it provides max-width.

Jul 23 '05 #4

"Martin Bialasinski" <ag********@u ni-koeln.de> wrote in message
news:87******** ****@haitech.ma rtin.home...
Check the IE7 Extension at
<http://dean.edwards.na me/IE7/compatibility/>, it provides max-width.


Looks like a truly incredible accomplishment. Jeez, if all this
functionality can be done with script, why couldn't hotshot MS programmers
have given MS consumers access to it via CSS?

Thanks much for the link.

nf
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

55
5014
by: Haines Brown | last post by:
I've been setting font-size 1em; as the default in my style sheets. Until now, that seemed to be ok. But now I'm beginning to wonder. My aim is to have an easily readable, but not overly large text when the user uses the default font size in his browser and uses the typical display resolution. I did a reinstall of my friendly browser in a different environment, and I am surprised to find that its default for serif is Times 16 and
21
2877
by: James Moe | last post by:
Hello, I just joined this group and saw the discussion "What do you think of resizing 1em to 10px?" I am somewhat confused by what y'all think should be used as a reference size. I was surprised that someone actually suggested ems as a reference. Ems are relative to a selected point size, the width in points of a capital M. If no point size is given, what size does an em become? The browser obviously must decide. Also setting the body...
60
4788
by: deko | last post by:
As I understand it, most browser manufacturers have agreed on 16px for their default font size. So, this should be an accurate conversion for percentages: px % 16 = 100 14 = 87.5 13 = 81.25
12
2176
by: Laphan | last post by:
Hi All Strange question this, but could somebody tell me what the old size=1, size=2 .... to size=7 font parameters are in pixels and points. I thought it was: size 1 = 7 pt size 2 = 14 pt size 3 = 21 pt
40
2981
by: Paul Davis | last post by:
Hi all, I'm building some style sheets and trying to play the old game of balancing designer pixel perfection and still allowing users to adjust their font sizes. The compromise I've made with the designer is that he'll accept allowing users to change font sizes it it "looks right" with the default setting. I'm using em to set the font size. So, anyway, here's the problem. At 0.96em we get the perfect font size. But, if the font is...
7
43939
by: carterweb | last post by:
This is how I do it now. 1. Determine the dimensions of the rectangle. 2. Set a my font size to a fixed maximum size. 3. Apply the font my string and measure the string using the graphics object. 4. If string size is less than the size of the rectangle, we are done.
30
4545
by: Takehiko Abe | last post by:
I have a <pelement with <ttinside: ;;; <p>A paragraph contains <tt>tt element</tt>.</p> I would like to set the font-size of the TT to the same as the containing <p>. This does not seem to work: ;;; p {
71
5810
by: Mark | last post by:
Sorry if the question is a bit basic. I generally express my font sizes in pixels, originally to handle the Macintosh/Windows font size differences (though I believe that they both now treat points the same way, at least within the browser window). It has been suggested that one should use ems to allow browsers to increase or decrease the text size. However, I have never had trouble with pixels.
11
8896
by: Ram | last post by:
Hey, I've got the following code: <font font-size="7">Hello</font> How can I calculate the font-size int the actual size in pixels? Thanks ahead! --sternr
1
1415
by: Oron.Morad | last post by:
Hello, I develop C#.NET (WinForm) over 2003server. I am looking for a way to adjust a component size (width pixels) according to a given text of a certain font (i.e font family, size and style) Lets say i have a sentence(english or hebrew), i want the textbox to expand and minimize if i change the font's size.
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10145
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4094
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3707
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.