By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,723 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,723 IT Pros & Developers. It's quick & easy.

CSS & Font Sizes

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.