CSS font-size dialogue!
February 22, 2005
/ Filed under: CSS
Here’s something I often confuse myself with... When developing a web site, let’s say I declare my main font values with the
This sets my entire site font to be 12 pixels, and Verdana – or the others, if Verdana is not available. This means that any element without a pre–defined font size will inherit the 12 pixels/Verdana.
Well, for example’s sake, all the header elements ( So, let’s say I’m using an After looking at it, I decide it’s too large, and I just want to bump down the font size a bit. So, I go to my CSS file, and type out this:
When I preview it, back in the browser, I am shocked at the results.
The answer is... since the So... instead of my giant In other words – 90% of 12 pixels. To picture this more clearly, a 100% font size for the
Sure! I could feasibly set my
Yes, there is.
So... this declaration:
... is the same as saying this:
To say 110%, you’d write 1.1 Make sense?
I will stop talking to myself now.
Comments/Mentions
|
Editor Picks
Email NewsletterSubscribe to the digest newsletter to receive posts by email: Recent Comments
Advertisements
|
Aha, yes this should work as expected, but I have, in many cases still had the same results with the font size being screwy. Not so much with the "h" tags, but when I use tables. (I know, I know, TABLES??!! ...only when necessary lol) Anyway, when I have defined a font size (using em) in the body tag, it doesn’t seem to carry over when using tables. This, my friend, is a real pain because then I have to go back into my style sheet and add the font size property to the table tag.
Oh, and forget about nested tables. If you build a table inside of a table, you get the same thing...font size shrinks. It really makes a case for figuring out the best way to go tableless in all your layouts!!