Best way to define font size?

This is a discussion on "Best way to define font size?" within the Web Page Design section. This forum, and the thread "Best way to define font size? are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 11th, 2006, 16:48
SuperMember

SuperMember
Join Date: Aug 2006
Location: Suffolk
Age: 30
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Best way to define font size?

Hi

Sorry for the basic question, but I've just read about font size and found that there are several ways to define it- percentage, em, pixels, etc.

The article I read suggested combining em and percentages. This seems a bit convoluted. I notice that css zen garden just use font: 8pt/16pt georgia.

Obviously I want to choose a method that gives the most control over the font size across the largest number of browsers.

Cheers,

Ruby
Reply With Quote

  #2 (permalink)  
Old Sep 11th, 2006, 16:51
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,713
Blog Entries: 1
Thanks: 0
Thanked 16 Times in 16 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Best way to define font size?

0.85 em or 0.9 em are usually good starting points.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #3 (permalink)  
Old Sep 11th, 2006, 17:04
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: Best way to define font size?

Ems are the best way to specify font sizes but you need to be aware of a number of things.

Specify a start point for the <body> tag and then use ems to go above and below this point. Even though it's a percentage a good starting point is 100.01%. This gets over a wierd bug in IE.

You also need to remeber that em is a relative size. Relative to the em size of its containing element. What this means is that if you have a div with its font-size set to 0.8em and inside this div you have another div with its font-size specified as 0.8em, the font in the ineer div will be 0.8 of 0.8.

So if your base point happened to be say 12px (set by the end user), then the first divs font as displayed would be 10px rounded up and the inner div's font would be 8px.

Some browsers like Firefox allow the user to specify both a base font size and a minimum font size, so what ever the sums work out at, the font will never be displayed any smaller than that.

So typically I will set the following:
Code: Select all
h1 - 1.4em
h2 - 1.2em
p - 0.85em
#nav - 0.75

Last edited by ukgeoff; Sep 13th, 2006 at 09:28. Reason: Missed some zeros.
Reply With Quote
  #4 (permalink)  
Old Sep 11th, 2006, 17:05
SuperMember

SuperMember
Join Date: Aug 2006
Location: Suffolk
Age: 30
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Best way to define font size?

Thanks Moojoo.

PS - split personality or master of disguise? I'm sure you were a man, then a woman, now text.

Ruby
Reply With Quote
  #5 (permalink)  
Old Sep 11th, 2006, 17:08
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,713
Blog Entries: 1
Thanks: 0
Thanked 16 Times in 16 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Best way to define font size?

Maybe I am Man, Woman, and ASCII.. Behold!
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #6 (permalink)  
Old Sep 12th, 2006, 11:09
SuperMember

SuperMember
Join Date: Aug 2006
Location: Suffolk
Age: 30
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Best way to define font size?

Thank you Geoff - am about to put your advice into practice.
Reply With Quote
  #7 (permalink)  
Old Sep 12th, 2006, 13:15
Reputable Member
Join Date: Jul 2005
Posts: 400
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Best way to define font size?

I found the 101% thing interesting, it was something I've yet to see one ounce of text on and I've read a lot of stuff on bugs.

Anyway, I did some reading on it and from what I've seen it should actually be 100.01% due to another browser having issues with 101%. This does have an interesting affect when you downsize the IE fonts. I played around before and after adding this setting and the text is much more legible after adding it.

Nice recommendation ukgeoff, works nicely.
Reply With Quote
  #8 (permalink)  
Old Sep 12th, 2006, 20:01
Highly Reputable Member
Join Date: Aug 2005
Location: 3rd Branch Up, Old Oak.
Age: 48
Posts: 658
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Best way to define font size?

Quote:
Originally Posted by rubyfruit22 View Post
Thanks Moojoo.

PS - split personality or master of disguise? I'm sure you were a man, then a woman, now text.

Ruby
He's Webforumz' very own self-proliferating entity.
Reply With Quote
  #9 (permalink)  
Old Sep 12th, 2006, 20:04
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,713
Blog Entries: 1
Thanks: 0
Thanked 16 Times in 16 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Best way to define font size?

And I can leap an em in a single bound? I like that 100.1% thing. very interesting. Although Ihave never had issues using em's in my browser testing.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
  #10 (permalink)  
Old Sep 13th, 2006, 09:16
SuperMember

SuperMember
Join Date: Aug 2006
Location: Suffolk
Age: 30
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Best way to define font size?

Loving the white boots
Reply With Quote
  #11 (permalink)  
Old Sep 13th, 2006, 13:51
masonbarge's Avatar
Highly Reputable Member
Join Date: Jan 2006
Location: Atlanta GA
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Best way to define font size?

If you have a complex design that breaks when font size changes, you'll want to use px for font-size. IE has reserved this measure not to change when the browser "view" is used to increase/decrease text size.

Ems are really nice to keep design from breaking, as long as you use them for vertical box element measurements.

I wouldn't advise anyone except an advanced css user to use %. The inheritance rules are just one more variable to mess you up.
Reply With Quote
  #12 (permalink)  
Old Sep 13th, 2006, 13:58
moojoo's Avatar
Moderator
Join Date: Aug 2005
Location: Texas
Age: 31
Posts: 1,713
Blog Entries: 1
Thanks: 0
Thanked 16 Times in 16 Posts
Send a message via AIM to moojoo Send a message via MSN to moojoo Send a message via Yahoo to moojoo
Re: Best way to define font size?

Your layouts should never break when fonts are resized. There is always a solution.
__________________
The internet is just a fad.
http://www.mevans76.com
Last Blog Entry: Apps every Mac based web dev should consider (Jul 10th, 2008)
Reply With Quote
Reply

Tags
best, define, font, size

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Font size question on websites? ugadawgvi Starting Out 2 Aug 3rd, 2007 16:50
IE7 font size and formatting - help Xhristy Web Page Design 4 Apr 3rd, 2007 17:35
How font size works in CSS? sahota Web Page Design 19 Dec 20th, 2006 22:56
font-size: does not work in <body> andersonoo7 Web Page Design 4 Jul 23rd, 2005 03:00
Overriding pre-set text/font size autumn_whispers2me Web Page Design 10 Apr 25th, 2005 17:24


All times are GMT. The time now is 05:43.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43