Saturday, May 30, 2009

How to set the font size using CSS

First reset 1em to 10px for the whole page.
body {
font-size: 62.5%; /* Resets 1em to 10px */
}

Finally, set the font size for a section, such as the content.
#content {
font-size: 1.6em;
line-height: 1.6em;
}

1.6em is equal to 16px.

The line-height is the distance between lines.

2 comments :

  1. my nokia n70 shows faded display. The screen has turned whitish. what might be problem? will formatting help?

    ReplyDelete
  2. @rahul: Perhaps your phone screen needs a repair.

    ReplyDelete