Basic Docs
cssdesign

Responsive Design

Mobile-first approach, breakpoints, and fluid typography for every screen.

Mobile-First Approach

Mobile-first means writing base CSS for the smallest screen and progressively adding styles for larger ones using min-width media queries. This results in leaner CSS, faster mobile load times, and a design process that starts from constraints rather than retrofitting them later.

Mobile (base)
Tablet (768px+)
Desktop (1024px+)
Why Mobile-First?
Desktop-first forces you to undo styles for smaller screens; mobile-first only adds them. Start minimal and enhance — it produces smaller, simpler stylesheets.
Traffic by Breakpoint
Mobile60 %
Tablet20 %
Desktop15 %
Large Screen5 %

Breakpoints

Breakpoints are the pixel thresholds where layout shifts occur. Common systems (Tailwind, Bootstrap) use a standard scale — memorize these values and your designs will stay in sync with utility class names.

sm
640px — large phones, small tablets
md
768px — tablets in portrait
lg
1024px — tablets in landscape, laptops
xl
1280px — desktops
2xl
1536px — wide monitors
custom
add your own in tailwind.config
Mobile-First Media Queries
/* Mobile-first — base styles target the smallest screens */
.container { padding: 1rem; }

/* Tablet and up */
@media (min-width: 768px) {
  .container { padding: 2rem; }
}

/* Desktop and up */
@media (min-width: 1024px) {
  .container {
    padding: 3rem;
    max-width: 1200px;
    margin-inline: auto;
  }
}

Fluid Typography

Fluid typography uses clamp() to smoothly scale font sizes between a minimum and maximum value based on viewport width. This eliminates abrupt jumps at breakpoints and gives every screen size an optimal reading experience.

Fluid Sizing with clamp()
/* clamp(min, preferred, max) — scales between breakpoints */
h1   { font-size: clamp(1.75rem, 5vw, 3rem); }
h2   { font-size: clamp(1.25rem, 3.5vw, 2rem); }
p    { font-size: clamp(0.9rem, 2vw, 1.125rem); }

/* Fluid spacing — no breakpoints needed */
.section { padding-block: clamp(2rem, 6vw, 6rem); }
.gap     { gap: clamp(1rem, 3vw, 2.5rem); }
Fixed TypographyFluid Typography
Static px values, unchanged between breakpointsScales continuously with viewport width
Requires separate media queries to resizeWorks without any media queries
Abrupt size jump at each breakpointSmooth, continuous transition across all sizes
Simple to implement and predictMore expressive, fewer override rules needed

Layout Patterns

A handful of layout patterns cover most real-world UIs. Each maps directly to CSS Grid or Flexbox and can be combined to build complex, fully responsive pages.

Common Responsive Patterns
Stack — single column, content flows vertically (default mobile layout)
Sidebar — fixed or percentage sidebar beside flexible main content
Holy Grail — header + footer with three-column middle section
Dashboard — grid of cards and widgets that reflow at each breakpoint

Testing Responsive Design

Responsive Development Workflow
1
Design Mobile
2
Add Tablet Styles
3
Add Desktop
4
Test All Sizes
5
Ship
Test Early, Test Often
Do not wait until the feature is complete to check responsiveness. Toggle device mode in DevTools while you build — catching layout breaks early is far cheaper than fixing them after the fact.
Chrome DevTools
Device toolbar with presets and custom dimensions
Firefox DevTools
Responsive design mode with touch simulation
Responsively App
Preview multiple screen sizes simultaneously
BrowserStack
Real device testing across iOS and Android
Built: 4/8/2026, 12:01:11 PM