Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to scale fonts according to resolution?

Status
Not open for further replies.

HarlemDiplomat

Programmer
Apr 18, 2002
3
US
I am looking for a way to change the font size for users who come to my site with different resolutions. If they have 800*600 resolution i would like to use smaller fonts - if they have 1024x768 I would like to use bigger fonts. Thanks!!
 
Don't do it.
Leave text size settings to your visitor.
Just don't use px units so the user can change it using browser Text size menu on his choice.
 
Starway is right - don't do it! Here's why...

Let's say my browser is set at 800x600 and I've set the text to 14pt (poor eyesight). Your web page comes along and says: 800x600 = 10pt fonts. Now I can't read it!

Now go the other way: 1024x768 and my fonts are set at 8pt (eagle eyes!). Your web page decides I should have 14pt text - now your page fills the screen (and then some) and I have to stand on the other side of the room to read it!

Last but not least, being the considerate web designer that you are, you'll want to reset the user's original font values when they exit your page. Not a problem unless they decide to open multiple web pages while they're in your site in which case all of these pages are using the new font values! Hmmmmm...... There's always a better way...
 
I agree with the above, but if for some reason you HAVE to change the font-size then the resolution (I guess you mean screen size rather than resolution which is dots per inch) is available to you (in IE at least) as screen.height and screen.width

You can then use these values in a bit of client-side script to alter the font sizes.

RW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top