tags:

views:

63

answers:

3

I've got the following html and css
In Firefox the computed font size is 16.66667px
In Chrome the computed font size is 13px

Needless to say there is a good bit of difference in these two sizes, one is too small to read, one is nicely sized. I guess one way to work around it is to set the font size to 16.67px but why is this the case.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
  <title>My first styled page</title>
  <style type="text/css">
    body {
        font-family: Arial, sans-serif;
        font-size: 10pt;
    }
  </style>
</head>
<body>

    This is some text.
</body>
</html>

All my measurements come from inspect element (using firebug in firefox)

A: 

Try setting the font size in PX like font-size:10px

Starx
That's not what the OP is asking.
Matt Ball
This doesn't answer the question at all.
Asaph
+1 It may not address the OP's question in a strict sense, but it resolves the OP's problem: inconsistent font sizes across multiple browsers.
kingjeffrey
A: 

The font sizes are different because the browser programmers make different assumptions about the normal user's system.

There's nothing wrong with that, and this is also why you should not use px to set the font size. On a computer with a high-resolution screen, your font will be too small. Certainly 10px will be unreadable on many people's computers.

I recommend How to Size Text in CSS for a good overview of your choices.

egrunin
Now that's what I'm talkin' about.
Matt Ball
The OP is specifying units in `pt` not `px`.
kingjeffrey
Article completely antiquated.
reisio
@resio: happy to see your link to a better one. @kingjeffrey: the other answer suggested `px`.
egrunin
@egrunin: the whole issue is irrelevant since browsers went to "zoom"ing instead of text resizing
reisio
@resio: only irrelevant if you don't mind a high bounce rate.
egrunin
+1  A: 

pt is a unit used for print and is not reliable for cross browser screen sizing. Try using another unit like px, em or a straight percentage.

kingjeffrey