DHTML/font size


I know I can set Font on my webpage I make to
font size="14"
or I can set it to
font size="16"

But if I set it like this
font size="mediume"

what size is it going to make it?

I know font size="16" and font size="20" will display the font on your webpage you make in point size but when you use
font size="small" or font size="mediume" or font size="large"

What is it doing?

You should always specify your font sizes within a CSS rule. Every font size should have a unit value (px, em, rem, etc.) at the end of it.

body {
  font-size: 62.5%;
h2 {
  font-size: 2em;

This is a cool technique. The default pixel size in a browser is 16 pixels.

16*62.5 = 1000, or 10 pixels.

Why is this good? Because we can now specify our em values to match the intended font size of a given element. We can "think" in pixels, but use ems. Ems are great to use because they scale well across many different devices. Pixels will not provide proper scaling. With our body acting as a parent font size (needed by our child em-sized elements, we can size our elements without having to calculate the right em value. In the above example, 2em is now equal to 20px. If we romoved the 62.5%, 2em would equal twice that of the parent font size, 32px. Using the 62.5% technique, sizing with ems becomes easier.


All Answers

Answers by Expert:

Ask Experts


Andrew Hoffman


Ask me about JavaScript, CSS, HTML5/XHTML, or PHP. Chances are I'll be able to help you. I know the economy is in the tank, but if you like my answer, please consider donating a few bucks. It's like tipping your barista, if your barista served fresh code instead of coffee.


I started doing this when boy bands were still cool.

I read a lot of nerdy books to get here.

©2017 About.com. All rights reserved.