Building Responsive Applications That Actually Work Everywhere

Beyond Media Queries
"Make it responsive" often means: add some media queries and hope for the best.
That approach creates applications that technically work on mobile but feel wrong. Buttons too small to tap. Text too small to read. Layouts that technically fit but make no sense.
True responsive design is about understanding context, not just screen width.
The Context Stack
We design for four layers of context:
- Screen size: Physical dimensions
- Input method: Touch, mouse, keyboard, voice
- Attention: Quick glance or deep focus
- Environment: Bright sunlight, dark room, noisy commute
A phone user on the subway has different needs than a desktop user in an office, even if they're viewing the same data.
Mobile-First Is Not Mobile-Only
We design mobile-first because it forces prioritization:
/* Mobile base styles */
.card {
padding: 1rem;
display: flex;
flex-direction: column;
}
/* Tablet and up */
@media (min-width: 768px) {
.card {
flex-direction: row;
padding: 1.5rem;
}
}
/* Desktop */
@media (min-width: 1024px) {
.card {
padding: 2rem;
}
}
But we don't stop at fitting content. We enhance for larger screens:
// Mobile: Stacked layout with touch-friendly spacing
// Desktop: Side-by-side with hover interactions
const ProductCard = ({ product }) => (
<div className="flex flex-col md:flex-row gap-4 p-4 md:p-6">
<img
src={product.image}
className="w-full md:w-48 aspect-square object-cover rounded-lg"
/>
<div className="flex-1">
<h3 className="text-lg md:text-xl font-semibold">{product.name}</h3>
<p className="text-muted-foreground mt-2 line-clamp-2 md:line-clamp-none">
{product.description}
</p>
<Button className="w-full md:w-auto mt-4">
Add to Cart
</Button>
</div>
</div>
);
Touch Targets That Work
The minimum touch target is 44x44 pixels. This isn't a guideline;it's accessibility:
// ✅ Properly sized touch target
<Button className="min-h-11 min-w-11 px-4 py-2">
<Icon size={24} />
<span className="sr-only">Menu</span>
</Button>
// ❌ Too small for touch
<button className="p-1">
<Icon size={16} />
</button>
For inline links, increase the clickable area without affecting visual layout:
.touch-link {
position: relative;
}
.touch-link::after {
content: '';
position: absolute;
inset: -8px; /* Expands clickable area */
}
Typography That Scales
Font sizes should be readable on any device:
:root {
/* Fluid typography: scales between 16px and 20px */
--font-size-base: clamp(1rem, 0.95rem + 0.25vw, 1.25rem);
/* Line height increases for smaller text */
--line-height-base: clamp(1.5, 1.4 + 0.25vw, 1.7);
}
body {
font-size: var(--font-size-base);
line-height: var(--line-height-base);
}
For headings, constrain maximum size to prevent absurdly large text on wide screens:
h1 {
font-size: clamp(1.75rem, 1.5rem + 1.5vw, 3rem);
max-width: 20ch; /* Prevent overly long lines */
}
Navigation Patterns
Navigation transforms based on context, not just screen size:
const Navigation = () => {
const { isMobile } = useMediaQuery();
const { isTouch } = useInputType();
// Mobile: Bottom tab bar or hamburger
if (isMobile) {
return <MobileNav />;
}
// Touch device (iPad): Larger targets, no hover states
if (isTouch) {
return <TouchNav />;
}
// Desktop: Full navigation with hover menus
return <DesktopNav />;
};
Mobile navigation priorities:
- Primary actions visible: 4-5 main destinations in bottom bar
- Secondary actions in menu: Settings, profile, less-used features
- Context-aware: Hide irrelevant actions based on current page
Forms That Adapt
Forms need different treatments for different inputs:
<Input
type="email"
inputMode="email" // Mobile keyboard optimization
autoComplete="email" // Autofill support
className="text-base" // Prevent iOS zoom on focus
/>
<Input
type="tel"
inputMode="tel"
autoComplete="tel"
pattern="[0-9]*" // Numeric keyboard on iOS
/>
For longer forms, break into steps on mobile:
const CheckoutForm = () => {
const { isMobile } = useMediaQuery();
if (isMobile) {
return <SteppedCheckout steps={['Shipping', 'Payment', 'Review']} />;
}
return <SinglePageCheckout />;
};
Performance Per Context
Different devices have different performance budgets:
// Load high-res images only on fast connections
const ProductImage = ({ src, alt }) => {
const { connection } = useNetworkInfo();
const quality = connection.effectiveType === '4g' ? 'high' : 'low';
const imageSrc = `${src}?quality=${quality}`;
return <img src={imageSrc} alt={alt} loading="lazy" />;
};
Reduce motion for users who prefer it or have low battery:
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
Testing Real Devices
Emulators lie. Real devices reveal truth.
Our testing matrix:
- iPhone SE (small screen)
- iPhone 14 Pro (medium screen)
- iPad Pro (tablet)
- Samsung Galaxy (Android baseline)
- Budget Android phone (performance testing)
- Mac/Windows desktop
We test every feature on physical devices before shipping. The extra hour catches issues that would take days to debug from user reports.
Responsive isn't a checkbox. It's a philosophy of meeting users where they are.