Yog Sharma

Typography - A Frontend Developer's Guide

By Yog Sharma on Oct 16, 2024
Image post

Typography: A Frontend Developer’s Guide

Typography 😊 is the art and technique of arranging type to make written language legible, readable, and appealing when displayed. As a frontend developer, you have a powerful toolset to manipulate text and create visually engaging experiences.

Core Concepts

Font Families

  • Serif: Fonts with decorative strokes at the ends of letters (e.g., Times New Roman, Georgia). πŸ–‹οΈ
  • Sans-Serif: Fonts without these strokes (e.g., Helvetica, Arial). 🚫
  • Monospace: Fonts where each character takes up the same amount of horizontal space (e.g., Courier New). ⌨️

Font Sizes

  • Relative Units: Use em and rem units for flexible and responsive typography. πŸ“
  • Absolute Units: Use px for fixed sizes. πŸ“
  • Viewport Units: Use vw and vh for size relative to the viewport. πŸ–ΌοΈ

Line Height

The vertical space between lines of text. ↕️

Letter Spacing

The space between individual letters. ↔️

Kerning

The adjustment of space between specific pairs of letters. 🀏

Font Weight

The thickness of a font (e.g., bold, light). πŸ‹οΈβ€β™€οΈπŸ‹οΈβ€β™‚οΈ

Text Transform

The case of text (e.g., uppercase, lowercase, capitalize). πŸ” 

Creating a Basic Typography Style Guide

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

h1 {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

p {
    color: #666;
    margin-bottom: 1rem;
}

Made with ❀️ in India