Skip to content

Responsive Design: Media Queries, Fluid Layouts, and Breakpoints

How to build layouts that work across devices; practical breakpoint strategy.

Rajesh DhimanFebruary 08, 20261 min read
On this page

30‑second interview answer

Responsive design means building UIs that adapt to different screens using fluid layouts, flexible media, and media queries when necessary. A good strategy is mobile-first: start with the smallest layout, then add breakpoints based on content needs—not based on specific devices.


Mobile-first approach

.card { padding: 12px; }
 
@media (min-width: 768px) {
  .card { padding: 20px; }
}

You start small and enhance.


Prefer fluid sizing over fixed

Use:

  • % for widths
  • rem for typography and spacing
  • clamp() for fluid typography

Example:

h1 {
  font-size: clamp(28px, 4vw, 48px);
}

Breakpoints: choose by content

Bad reasoning:

  • “iPhone breakpoint, iPad breakpoint…”

Good reasoning:

  • “Layout breaks at ~680px because the card becomes cramped.”

Responsive images

  • Use max-width: 100% to prevent overflow.
img { max-width: 100%; height: auto; }

Common pitfalls

  1. Hardcoding too many breakpoints
  2. Fixed heights causing overflow
  3. Using px everywhere for fonts

Mini Q&A

Q1: What is mobile-first?

  • Base styles for small screens, add min-width queries.

Q2: When do you add a breakpoint?

  • When the content/layout needs it.

Q3: Why use clamp()?

  • Fluid typography without many breakpoints.

Summary checklist

  • I use mobile-first.
  • I prefer fluid layouts.
  • My breakpoints are content-driven.
  • Images never overflow containers.
Companion Book

Looking for structured, offline interview prep?

Free online lessons • Portable Amazon Kindle / Paperback

Frontend Interview Guide (2025 Edition) cover
Recommended for React & Frontend Rounds

Frontend Interview Guide (2025 Edition)

By Rajesh Dhiman

Comprehensive preparation covering React internals, Web Performance, CSS architecture, and system design questions.

View on Amazon ↗Kindle & Paperback
JavaScript Interview Guide cover
Recommended for Core JS Rounds

JavaScript Interview Guide

By Rajesh Dhiman

Deep dive into the Event Loop, microtask draining, closures, prototypal inheritance, and asynchronous execution patterns.

View on Amazon ↗Kindle & Paperback

Note: All lessons on Frontend Interview remain completely free to read online. As an Amazon Associate, we may earn from qualifying purchases.

RD

Written by Rajesh Dhiman

Authored by Rajesh Dhiman and engineered at Eunix Tech. Focused on deep-dive frontend engineering, JavaScript runtime internals, React architecture, and web performance.