Logo hdtoledo
hdtoledo.dev
Módulos_del_Sistema
MÓDULO_TEÓRICO

Typography, Colors, and the Spacing Scale

Typography and Colors

Tailwind's Visual Design Language

Tailwind does not use arbitrary numbers. It is built upon a harmonious mathematical design system. Once you understand its naming grammar, you will build interfaces at breakneck speed without looking at docs.


1. The Spacing Scale (Padding & Margin)

Tailwind relies on a universal scale where 1 unit = 0.25rem = 4px.

  • p-1 = 4px
  • p-2 = 8px
  • p-4 = 16px (1rem)
  • p-6 = 24px (1.5rem)
  • p-8 = 32px (2rem)

Spacing Directions:

  • px-6: Horizontal padding (left and right).
  • py-4: Vertical padding (top and bottom).
  • pt-8: Top padding only (padding-top).
  • mx-auto: Automatic horizontal centering (margin: 0 auto).
  • gap-4: Gutter spacing between Flexbox and Grid items.

2. Typography Hierarchy

Control font sizes, weights, and tracking with mathematical precision:

html
<!-- Main Headline --> <h1 class="text-4xl font-extrabold tracking-tight text-white"> Nexus Control Center </h1> <!-- Subhead --> <h2 class="text-xl font-semibold text-cyan-400 mt-2"> Real-Time Monitoring </h2> <!-- Relaxed leading paragraph --> <p class="text-sm font-normal text-slate-400 leading-relaxed max-w-lg mt-1"> Inspect live transaction throughput and global server cluster latency. </p>

3. Color Palettes & Smart Opacity Modifiers

Every native Tailwind color features shades from 50 (lightest) to 950 (deepest dark tone).

Furthermore, you can specify instant alpha opacity using a slash /:

  • bg-slate-900/80: Deep slate at 80% opacity (the cornerstone of Glassmorphism!).
  • text-cyan-400/90: Cyan text with 90% intensity.
  • border-cyan-500/20: Subtle border glowing at 20% alpha.