467,104 Members | 963 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,104 developers. It's quick & easy.

CSS & Font Sizes

I'm just after a bit of wisdom here.

If I specify something like

body { font-size: 1em; }

is this really the same as

body { font-size: 100%; }
?

Which is preferred, or is it a matter of taste?

And what is the difference between the above and not specifying the
font-size at all?

Thanks

Mark
Apr 22 '07 #1
  • viewed: 1420
Share:
3 Replies
Mark wrote:
I'm just after a bit of wisdom here.

If I specify something like

body { font-size: 1em; }

is this really the same as

body { font-size: 100%; }
?
They give the same result.
Which is preferred, or is it a matter of taste?
100% is preferred, due to a bug in IE6 and lower (maybe 7 too?) where em
unit will not scale correctly when user changes size (Medium to Large,
etc).
And what is the difference between the above and not specifying the
font-size at all?
None, except if you do declare it, you show your intent on being
correct. <g>

--
-bts
-Motorcycles defy gravity; cars just suck
Apr 22 '07 #2
Beauregard T. Shagnasty wrote:
Mark wrote:
> body { font-size: 1em; }
body { font-size: 100%; }
And what is the difference between the above and not specifying the
font-size at all?

None, except if you do declare it, you show your intent on being
correct. <g>
Also, if you do use em units elsewhere in the stylesheet, IE will give
more predictable results if you set font-size:100% first.

--
Berg
Apr 22 '07 #3
Bergamot wrote:
Beauregard T. Shagnasty wrote:
>Mark wrote:
>> body { font-size: 1em; }
body { font-size: 100%; }
And what is the difference between the above and not specifying the
font-size at all?
None, except if you do declare it, you show your intent on being
correct. <g>

Also, if you do use em units elsewhere in the stylesheet, IE will give
more predictable results if you set font-size:100% first.
Thanks for your help. I wasn't aware of the IE bug so that simplifies
things.

Mark
Apr 22 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by johnny | last post: by
7 posts views Thread by R0bert Nev1lle | last post: by
60 posts views Thread by deko | last post: by
16 posts views Thread by maya | last post: by
3 posts views Thread by coyttl@gmail.com | last post: by
59 posts views Thread by Andy Fish | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.