Acts of Volition

Comments

allison -

aov fonts are too small (mozilla with default font size set at 13px).

Steven Garrity -

Allison, while the font sizes here on AoV aren't really what I'm talking about - it appears to me that the default font size in Mozilla is 16 pixels, which seems to render the fonts at a reasonable size. That said - the Georgia font and size I use here is a little hard to read when smoothed on OS X. I'll try to address this in the next version.

Simon Willison -

Is there any reason you haven't looked at ems for relative font sizing? They work very much like percentages (1em is equivalent to 100%, 0.8em is equivalent to 80%) but importantly do not suffer from the recursive inheritance problem. My favoured solution for font sizes these days is to set the basic font size for the document using keywords (and the box mdoel hack to knock older versions of IE in to line) and then set the size of headers, footnotes and so forth using ems (relative to the normal text size).

Another useful trick I have found is that, while verdana at default size (with no font sizing applied at all) loks pig ugly, Georgia at default size actually stays quite attractive. Most designers hate the idea of leaving the font size as the browser4 standard but I have found that, provided you are using Georgia or another font that looks reasonable at default size, it can save an awful lot of hassle.

Stephen DesRoches -

Simon: After testing the idea of using ems for relative font sizing we found an inconsistency between html and xhtml.

When you claim that em does "not suffer from the recursive inheritance problem" was the doc type of your site xhtml?

Adam Kalsey -

Instead of browser sniffing for old browsers, use a method of linking the stylesheet that they don't understand. They'll ignore it, and smart browsers will use it.

Load all your dumb styles in core.css. Then override each of those in smart.css. At the end of core.css, add the line
@import "/path/to/smart.css";

When smart browsers read core.css, they will read in smart.css as well. Older browsers don't understand @import and won't even know smart.css exists.

Matt Round -

I try to stick with ems nowadays, often via @import, and towards the end of development bolt on a pixels-only style sheet for non-DOM browsers via JavaScript.

Ems only become a nightmare with heavily nested tables, which are best avoided anyway. You can use descendant selectors (e.g. "td p {font-size:1em}" ) to bump nested font sizes back up to normal size where needed, that works fine.

So if you've got lots of nested tables stick with pixels, otherwise use minimal markup and ems.

Steven Garrity -

Good points Adam and Matt. We've stuck to the server-side browser sniffing for NS4 for now because we're using it for a few other issues (form input sizes).

Can any one explain the difference between ems and percentages? From what I can gather, in IE6, when in XHTML ems don't inherit, but in HTML4, they do. Percentages seemt to do the exact opposite (inherit in XHTML, but not in HTML4). Any other key differences?

Simon Willison -

Steven: Yes, I do everything these days in XHTML 1.0 Strict with a doctype that kicks browsers in to standards compliance mode. I didn't realise there were any inconsistencies between HTML and XHTML with that regard - thanks for pointing that out :)

The main difference between ems and percentages comes when you start using them for widths/height/margin/padding of a block. 5em means "5 times the height of a letter within this block", while 500% would mean "5 times the width of the containing block" - they have very different meanings. Using ems for this kind of measurements is often a good idea as they will resize when the user increases/decreases the text size setting of their browser.

There is a note about this on the CSS-Discuss wiki: http://css-discuss.incutio.com/?page=UsingEms

Will -

Just my very humble two cents, being only an amateur, but I've always stuck with pixels ala Zeldman's Give me Pixels or Give me Death. When it comes down to a disagreement between crusty Neilsen and forward-thinking Zeldman, I usually go with the latter.

That being said, you are still not limited to fixed text sizes. Zeldman himself uses what I believe to be a tasteful "widget" for text styling on his page, which also happens to validate as XHTML 1.0 - serving your original purpose.

So with a little swallowing of pride on the widget discrimination, you get the best of both worlds. I call it the Ockham's razor argument.

tim -

The incredible Mr. Briggs on CSS font sizes.

David -

Another 'spanner in the works' - it appears Firefox is rendering % font sizes smaller than Firebird, Mozilla, Opera or IE.

Alan Atkinson -


Does anybody but me think this "font size on web pages" problem is insane, unreasonable, a problem that never should have happened in the first place?

The very essence of the web is words on a monitor; flashing lights and whirring gears are strictly secondary. And yet the very hardest thing to do is put legible words on a page--or words that are legible for all users.

When a problem appears insoluble, then the real solution is always one step earlier. In this case that "one step" leads not to webmasters, but to the browsers themselves.

It can't possibly be so hard for Microsoft and Netscape to make uniform font sizes that will respond to resize commands in a uniform way. What on earth can these people be thinking?

- Alan Atkinson -