I notice no one has touched on how em
works as a font size unit, so I'll try to clear that up for you.
There are two ways to tell the browser how large your fonts should be rendered.
- setting an absolute size
For absolute sizes, like px
or pt
, you're telling the browser exactly what size you want the text to be. If you write 12px
, it's going to come out as exactly 12 pixels tall.
- setting a relative size —
em
is a relative size.
For relative sizes, like em
, you're telling the browser how big to make the text with respect to other text on the page. This works sort of like a percentage, so if your footer text is sized at 0.8em
, it will be rendered 80% as tall as the main text on the page.
This explains why you're getting different sizes on different pages. If the font size of the body is set explicitly on one page, but not set at all on another (or set explicitly to a different size) that will make your em
-sized fonts render at different sizes.
This is also why it's really bad to use <font>
tags. It's going to be a serious pain to dig around those tags and figure out what explicit sizes are being set that might be throwing off your em
s.
When you set your font sizes using CSS, this is not only an information which is easy to find, but also a property which is easy to modify.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…