Responsive Design: Adapt or Perish

Pascual Vila
Frontend Instructor // Code Syllabus
"You do not design for a specific screen size. You design for an infinite continuum of sizes. The web is fluid, your layouts should be too."
The Viewport Meta Tag
Without the viewport meta tag, mobile devices assume your site is designed for desktop (usually ~980px wide) and scale it down to fit the screen. The result? Unreadable text and tiny buttons.
Always include this in your HTML <head>: <meta name="viewport" content="width=device-width, initial-scale=1.0">
Mobile-First Strategy
Historically, developers built desktop sites first, then wrote media queries to shrink things for mobile. This required overriding complex layouts.
Mobile-First flips this. You write the mobile styles as your baseline (no media queries). Then, you use min-width media queries to progressively enhance the layout for tablets and desktops. This is cleaner, faster to render, and ensures the core content is prioritized.
Fluid Units (vw, vh, rem, %)
- Percentage (%): Relative to the parent element. Perfect for fluid containers.
- Viewport Units (vw, vh):
1vwis 1% of the viewport width. Great for hero sections (height: 100vh). - rems: Relative to the root HTML font-size. Never use
pxfor fonts; useremto respect user accessibility settings.
❓ Frequently Asked Questions
Responsive vs. Adaptive Web Design?
Responsive: Fluid layouts that smoothly change at any width using relative units and flexible grids.
Adaptive: Uses distinct layouts for specific screen sizes (e.g., exactly 320px, 768px, 1024px). It snaps between layouts. Responsive is considered the modern best practice.
How do I avoid using too many Media Queries?
Lean heavily on CSS Grid and Flexbox. Using properties like flex-wrap: wrap or grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)) allows the browser to calculate when to stack elements without you having to hardcode breakpoints.