Typography in Digital Design
Bhavana
UI/UX Designer
Typography is the foundation of digital design. The typefaces you choose and how you implement them can make or break your user experience. In this guide, I’ll share everything I’ve learned about typography for the web.
Why Typography Matters
Good typography does more than look nice. It directly impacts how users engage with your content:
Users form opinions about your brand in milliseconds. Typography is often the first thing they subconsciously evaluate.
The Type Scale
A consistent type scale creates visual harmony. I use a modular scale based on a 1.25 ratio:
| Name | Size | Line Height | Use Case |
|---|---|---|---|
| xs | 12px | 1.5 | Labels, captions |
| sm | 14px | 1.5 | Body small, helper text |
| base | 16px | 1.6 | Body text |
| lg | 18px | 1.6 | Lead paragraphs |
| xl | 20px | 1.5 | Subheadings |
| 2xl | 24px | 1.4 | Section headings |
| 3xl | 30px | 1.3 | Page titles |
| 4xl | 36px | 1.2 | Hero text |
Use relative units like rem instead of px. This respects user preferences and improves accessibility.
Font Pairing Principles
The key to great font pairing is contrast with cohesion:
- Contrast in style — Pair serif with sans-serif for visual interest
- Similar x-height — Fonts should align when used together
- Matching mood — Both fonts should convey the same brand personality
- Limit to 2-3 — More fonts create visual chaos
Implementing in CSS
Here’s how I structure typography in modern CSS:
:root {
/* Font families */
--font-display: "Instrument Serif", Georgia, serif;
--font-body: "DM Sans", system-ui, sans-serif;
--font-mono: "JetBrains Mono", monospace;
/* Type scale */
--text-xs: 0.75rem;
--text-sm: 0.875rem;
--text-base: 1rem;
--text-lg: 1.125rem;
--text-xl: 1.25rem;
--text-2xl: 1.5rem;
--text-3xl: 1.875rem;
--text-4xl: 2.25rem;
} Always include fallback fonts. System fonts load instantly and prevent layout shift.
Text Color Hierarchy
Use a limited palette of grays to establish clear hierarchy:
Text Color Scale
Here are the specific colors I use for text:
Text Colors
// Text color tokens
const textColors = {
primary: '#fafafa', // Headlines, important text
secondary: '#a3a3a3', // Body text, descriptions
muted: '#666666', // Captions, timestamps
disabled: '#404040', // Inactive elements
}; Brand Color Examples
When building a design system, define your full color palette upfront:
Brand Palette Example
Responsive Typography
Font sizes should adapt to viewport width. Use fluid typography:
/* Fluid type scale */
h1 {
font-size: clamp(2rem, 5vw + 1rem, 4rem);
line-height: 1.1;
}
body {
font-size: clamp(1rem, 0.5vw + 0.875rem, 1.125rem);
line-height: 1.6;
} - Set minimum size for mobile readability
- Use vw units for fluid scaling
- Cap maximum size to prevent oversized text
Accessibility Considerations
Typography accessibility is non-negotiable:
Never go below 16px for body text. Smaller sizes strain eyes and hurt mobile users.
- Minimum contrast ratio of 4.5:1 for text
- Line height of 1.5 or more for body text
- Paragraph width between 50-75 characters
- Avoid justified text—it creates uneven spacing
Recommended Resources
Fontshare
Free, high-quality fonts for personal and commercial use.
Type Scale
Visual calculator for creating harmonious type scales.
Fontpair
Curated font combinations with live previews.
Key Takeaways
“Typography is what language looks like.” — Ellen Lupton
Master these fundamentals and your designs will feel more professional:
- Use a consistent type scale based on a ratio
- Limit fonts to 2-3 maximum
- Always include fallback fonts
- Implement fluid typography for responsive design
- Prioritize readability over aesthetics
Review your current project’s typography. Is there a consistent scale? Are fonts loading efficiently? Small tweaks make a big difference.