0Pricing
CSS Academy · Lesson

Font Size Weight and Style

Control text size with font-size, weight with font-weight, and style with font-style.

font-size

font-size sets the height of glyphs. It accepts any length unit. Using rem is recommended for scalable, accessible typography.

html { font-size: 16px; }
body { font-size: 1rem; }    /* 16px */
h1   { font-size: 2.5rem; }  /* 40px */
small { font-size: 0.75rem; } /* 12px */

Keyword Font Sizes

CSS also provides absolute keyword sizes (xx-small to xx-large) and relative keywords (smaller, larger) relative to the parent font size.

p.note { font-size: smaller; }
p.big  { font-size: x-large; }

All lessons in this course

  1. Font Family and Web-Safe Fonts
  2. Font Size Weight and Style
  3. Text Alignment Decoration and Spacing
  4. Google Fonts and @font-face
← Back to CSS Academy