Fonts and Units

  • Font sizes are usually specified using px, em, %, rems, or keywords
  • If you use pixels to specify your font size, you are telling the browser how many pixels tall to make your letters.
  • em and % are relative font sizes, so specifying your font size using em and % means the size of the letters will be relative to the font size of the parent element.
  • Using relative sizes for your fonts can make your pages more maintainable and responsive
  • Use the font size keywords to set the base font size in your body rule, so that all browsers can scale the font sizes if users want the text to be bigger or smaller.

Additional Resources