Back to Blog
Design

Typography for the Web: The Complete Guide

Master web typography to create readable, accessible, and beautiful text experiences that engage users.

Isabella Torres
Isabella Torres
Author
10 January 2026
15 min read
Typography for the Web: The Complete Guide
# Web Typography: The Complete Guide

Typography is 95% of web design. Get it right, and everything else falls into place.

Why Typography Matters

#

Impact
  • 95% of information on web is text
    • Typography affects readability
      • Influences user perception
        • Defines brand personality

          Fundamental Principles

          #

          1. Hierarchy

          ```css /* Clear visual hierarchy */ h1 { font-size: 2.5rem; font-weight: 700; } h2 { font-size: 2rem; font-weight: 600; } h3 { font-size: 1.5rem; font-weight: 600; } p { font-size: 1rem; font-weight: 400; } small { font-size: 0.875rem; } ```

          #

          2. Contrast

          ```css /* Size, weight, and color contrast */ .title { font-size: 3rem; font-weight: 800; color: #000; }

          .subtitle { font-size: 1.25rem; font-weight: 400; color: #666; } ```

          #

          3. Alignment

          ```css /* Consistent alignment */ .text-left { text-align: left; } .text-center { text-align: center; } .text-right { text-align: right; } ```

          #

          4. White Space

          ```css /* Breathing room */ p { line-height: 1.6; margin-bottom: 1.5rem; }

          h2 { margin-top: 2rem; margin-bottom: 1rem; } ```

          Choosing Fonts

          #

          Font Categories

          Serif

          • Traditional, trustworthy
            • Better for print
              • Examples: Georgia, Times New Roman, Merriweather

                Sans-Serif

                • Modern, clean
                  • Better for screens
                    • Examples: Arial, Helvetica, Inter, Roboto

                      Monospace

                      • Technical, precise
                        • Code snippets
                          • Examples: Courier, Monaco, Fira Code

                            Display

                            • Decorative, attention-grabbing
                              • Headlines only
                                • Examples: Playfair Display, Lobster

                                  #

                                  Pairing Fonts

                                  Rule 1: Contrast Pair serif with sans-serif

                                  Rule 2: Limit Max 2-3 font families

                                  Rule 3: Hierarchy Distinct purposes

                                  Example Pairings: ```css /* Classic */ headings: 'Playfair Display', serif; body: 'Source Sans Pro', sans-serif;

                                  /* Modern */ headings: 'Montserrat', sans-serif; body: 'Open Sans', sans-serif;

                                  /* Tech */ headings: 'Inter', sans-serif; body: 'Inter', sans-serif; code: 'Fira Code', monospace; ```

                                  Web Fonts

                                  #

                                  Google Fonts

                                  ```html ```

                                  ```css body { font-family: 'Inter', sans-serif; } ```

                                  #

                                  Self-Hosted Fonts

                                  ```css @font-face { font-family: 'CustomFont'; src: url('/fonts/custom.woff2') format('woff2'), url('/fonts/custom.woff') format('woff'); font-weight: 400; font-style: normal; font-display: swap; } ```

                                  #

                                  Font Loading

                                  ```css /* Prevent FOUT */ @font-face { font-family: 'Inter'; font-display: swap; /* or optional, fallback */ src: url('inter.woff2') format('woff2'); } ```

                                  Readability

                                  #

                                  Line Length

                                  Optimal: 45-75 characters per line

                                  ```css .content { max-width: 65ch; /* characters */ margin: 0 auto; } ```

                                  #

                                  Line Height

                                  Body text: 1.5-1.8 Headings: 1.2-1.4

                                  ```css p { line-height: 1.6; }

                                  h1 { line-height: 1.2; } ```

                                  #

                                  Font Size

                                  Base: 16-18px Mobile: 16px minimum

                                  ```css html { font-size: 16px; }

                                  @media (min-width: 768px) { html { font-size: 18px; } } ```

                                  #

                                  Letter Spacing

                                  ```css /* Uppercase needs more */ .uppercase { text-transform: uppercase; letter-spacing: 0.1em; }

                                  /* Headings: slight tightening */ h1 { letter-spacing: -0.02em; } ```

                                  Responsive Typography

                                  #

                                  Fluid Type Scale

                                  ```css html { font-size: 16px; }

                                  @media (min-width: 768px) { html { font-size: calc(16px + (18 - 16) * ((100vw - 768px) / (1440 - 768))); } }

                                  @media (min-width: 1440px) { html { font-size: 18px; } } ```

                                  #

                                  Clamp Function

                                  ```css .title { font-size: clamp(2rem, 5vw, 4rem); } ```

                                  Accessibility

                                  #

                                  Contrast

                                  WCAG AA:

                                  • Normal text: 4.5:1
                                    • Large text: 3:1

                                      ```css /* Good contrast */ .text { color: #333; /* on white */ }

                                      /* Poor contrast - avoid */ .text-bad { color: #999; /* on white */ } ```

                                      #

                                      Font Size

                                      ```css /* Never below 16px */ body { font-size: 16px; }

                                      /* Allow user scaling */ html { font-size: 100%; /* respects user preferences */ } ```

                                      #

                                      Line Height

                                      WCAG requires at least 1.5 for body text

                                      Micro-Typography

                                      #

                                      Quotes

                                      ```html "Hello"

                                      “Hello” ```

                                      #

                                      Dashes

                                      ```html well-known

                                      2020–2026

                                      He was late—again. ```

                                      #

                                      Apostrophes

                                      ```html Don't

                                      Don’t ```

                                      Special Cases

                                      #

                                      Code Blocks

                                      ```css code { font-family: 'Fira Code', monospace; font-size: 0.9em; background: #f5f5f5; padding: 0.2em 0.4em; border-radius: 3px; }

                                      pre code { display: block; padding: 1rem; overflow-x: auto; line-height: 1.5; } ```

                                      #

                                      Links

                                      ```css a { color: #0066cc; text-decoration: underline; }

                                      a:hover { color: #0052a3; }

                                      a:visited { color: #6b0099; } ```

                                      #

                                      Lists

                                      ```css ul, ol { margin-left: 1.5em; margin-bottom: 1.5rem; }

                                      li { margin-bottom: 0.5rem; } ```

                                      Performance

                                      #

                                      Font Subsetting

                                      Include only needed characters:

                                      ``` ?family=Inter:wght@400;600;700&text=ABCDEFabcdef0123456789 ```

                                      #

                                      Variable Fonts

                                      Single file, multiple weights:

                                      ```css @font-face { font-family: 'Inter'; src: url('inter-var.woff2') format('woff2-variations'); font-weight: 100 900; } ```

                                      #

                                      Preloading

                                      ```html ```

                                      Type Scale

                                      #

                                      Modular Scale

                                      ```css :root { --ratio: 1.25; /* Major third */ --text-xs: 0.64rem; --text-sm: 0.8rem; --text-base: 1rem; --text-lg: 1.25rem; --text-xl: 1.563rem; --text-2xl: 1.953rem; --text-3xl: 2.441rem; --text-4xl: 3.052rem; } ```

                                      Tools

                                      - Google Fonts: Free fonts

                                      • Adobe Fonts: Premium fonts
                                        • Font Squirrel: Font identifier
                                          • Type Scale: Scale generator
                                            • Modular Scale: Calculator
                                              • WebAIM: Contrast checker

                                                Best Practices

                                                ✅ Use system fonts for performance ✅ Limit font weights loaded ✅ Set proper fallbacks ✅ Test on real devices ✅ Consider reading distance ✅ Ensure sufficient contrast ✅ Allow user scaling ✅ Test with real content

                                                Common Mistakes

                                                ❌ Too many fonts ❌ Poor contrast ❌ Lines too long ❌ Font size too small ❌ Insufficient line height ❌ Center-aligning body text ❌ Ignoring accessibility

                                                Checklist

                                                ☐ Readable font size (16px+) ☐ Proper line height (1.5+) ☐ Optimal line length (45-75ch) ☐ Good contrast (4.5:1+) ☐ Clear hierarchy ☐ Consistent spacing ☐ Font pairing works ☐ Mobile-friendly ☐ Accessible ☐ Performant

                                                Conclusion

                                                Great typography:

                                                • Is readable
                                                  • Is accessible
                                                    • Supports content
                                                      • Is invisible (users don't notice)

                                                        Poor typography:

                                                        • Hurts readability
                                                          • Frustrates users
                                                            • Distracts from content

                                                              Invest time in typography. Your users will thank you.

Share this article

Stay Updated

Subscribe to our newsletter for the latest insights and updates.

Website packages from R5,500
Special offer

Website packages from R5,500

Launch-ready business websites with hosting and support included.