tags:

views:

54

answers:

2

Hi there, I would like to know some opinions from experienced developers on what they think the definitive way to size fonts (in a base sense). I know that working with ems is considered best but im referring to the best way to set the base font size.

There is the technique of setting font to 10px using 62.5 method but i think ie has an issue with rounding which throws this out slightly (perhaps not)

YUI framework uses

body {
font:13px/1.231 arial,helvetica,clean,sans-serif;
/* for IE6/7 */ 
*font-size:small; 
/* for IE Quirks Mode */
*font:x-small; 

}

which really confuses me!

Tripoli uses

html
{
   font-size:125%;
}

body
{
    font-size:50%;
}

a list apart suggest something along the lines of :

body {

font-size: 16px;
*font-size: 100%;

}

So which is the best either out of these methods or any alternatives. The best being the easiest to work with and the most reliable cross browser.

+2  A: 

Well lately people have been going back to straight pixel sizing because all the modern browsers Zoom functionality increases everything proportionally now, rather than just increasing the font size as in previous versions. 12px is the standard base size for standard text that I've seen.

Shawn Steward
+1 - 12px ... try telling that to Facebook with its 2px fontsize
Aiden Bell
would that not mean the whole layout would have to be sized in pixels also?
David
No you don't need to use the same format for the layout.
Shawn Steward
but if your layout is set in percentage or ems and the font is sized in pixels and the user resizes using eiher the text increase or zoom then will the layout not get messed up more easily
David
IE7 and IE6 still have issues with px. Sure they are not modern browsers but they are still used, alas.Assistive technologies also can have issues with px-based layouts and they cost so much that their users tend to use very old models (and they can rely on IE6/7, bad combo)
Felipe Alsacreations
Yes, it of course depends on your target audience, etc. Just saying for modern development it seems to be the way people are heading.@David - If the CSS is done cleanly it doesn't matter if your text is in pixels and layout is in percents. Browsers now just zoom everything together so it all scales accordingly.
Shawn Steward
@Shawn thats interesting, as i would assume most users now use zoom instead of text increase This would laso have the side effect then that sizing everything in pixels becomes possible and fluid and elastic layouts become redundant. Sounds great in theory but there must be a catch - surely. Accessibility perhaps? Also, I am a recent graduate and am trying to find employment and hence starting to build a portfolio etc. Do you think the majority of employers will expect (looking at my code) that i should be using fluid, elastic hybrid layouts as opposed to using pixels to size everything?
David
It really depends on the application. A lot of real popular sites are static widths. Some sites just don't look good when they're stretched out to a large width. I think it would be good to show you can do both.
Shawn Steward
A: 

There is the technique of setting font to 10px using 62.5 method but i think ie has an issue with rounding which throws this out slightly (perhaps not)

That's the technique I use daily and I didn't encounter any IE bug due to this, if such a bug exists. Working with em is then really easy, as long as you can divide by ten without using a calc! You just have to use font-size property with elements like hN, li, p and so on but don't try to size both a parent div or blockquote and child paragraphs and headings otherwise children elements don't have the 10px<->1em equivalence anymore.

If you use a CSS framework, stick to the method it uses.

Off topic, I use conditional comments and no star hacks. Ever.

That said, there's no definitive answer to your question (sb wrote 'em vs px is an holy war' on a recent topic and (s)he is quite right IMHO).

From an accessibility point of view, here is a corresponding sufficient technique : C14: Using em units for font sizes - WCAG 2.0 It's not the only way to achieve Success Criteria 1.4.4 Resize text:

Except for captions and images of text, text can be resized without assistive technology up to 200 percent without loss of content or functionality. (Level AA) 

C12 is the same, only with percentages, others aren't, as far as i remember, as cross-browser compatible.

Felipe Alsacreations
yes star hacks do invalidate the css but is there anything else you have against using them?
David
It's a sufficient reason for me. Other than that one, any other parser with the same bug, now or in the future, could interpret the corresponding CSS and it can be avoided with a safe and valid technique provided by MSFT itself : conditional comments. So why not prefer the latter?
Felipe Alsacreations
thats a very good argument and i have sat here for a few minutes trying to think of a reason to disagree with you. The best i can come up with is that its easier to use a star hack. Thats actually really a pathetic excuse so i guess from now on i will use conditional comments.
David