Mobile-First Design: How to Build Websites That Work on Every Device
Why mobile-first is the only viable approach
Over 60% of global web traffic comes from mobile devices. Google uses mobile-first indexing, meaning it primarily evaluates the mobile version of your site for ranking. If your site doesn't work well on mobile, you're losing the majority of your audience and your search rankings simultaneously.
Mobile-first design means starting the design process with the smallest screen and progressively enhancing for larger ones. This forces you to prioritize content, simplify navigation, and focus on what actually matters to users. The result is a cleaner experience on every device — not just mobile.
Building responsive layouts
Responsive design uses CSS to adapt layouts to different screen sizes. The core tools:
- CSS Grid and Flexbox — Use
gridfor page-level layouts andflexboxfor component-level alignment. Avoid fixed widths; usefrunits, percentages, andmin()/max()/clamp()for fluid sizing. - Media queries — Define breakpoints where the layout shifts. Common breakpoints: 480px (small phones), 768px (tablets), 1024px (laptops), 1280px (desktops). Design for the content, not specific devices.
- Container queries — A newer CSS feature that lets components respond to their parent container's size rather than the viewport. Ideal for reusable components that appear in different layout contexts.
- Fluid typography — Use
clamp(1rem, 2.5vw, 1.5rem)to scale font sizes smoothly between breakpoints instead of jumping at media query boundaries.
Test your layout at every width between 320px and 1920px, not just at breakpoints. Bugs often appear between breakpoints, not at them.
Tip
Set a max-width on your content container (usually 1200-1400px) and center it. Full-width content on a 4K monitor is unreadable.
Touch targets and mobile interactions
Mobile users interact with their fingers, not a precise mouse cursor. This changes everything about interactive elements:
- Minimum touch target size — Google recommends at least 48x48 CSS pixels for all tappable elements. Apple's Human Interface Guidelines suggest 44x44 points. Smaller targets cause accidental taps and frustration.
- Spacing between targets — Leave at least 8px of space between adjacent tappable elements. Closely packed links in a footer or navigation are a common offender.
- Thumb zones — On phones, the most comfortable tap area is the lower-center of the screen. Place primary actions (CTAs, navigation) within easy thumb reach. Avoid critical buttons in the top corners.
- Avoid hover-dependent interactions — Dropdown menus that open on hover don't work on touch devices. Use tap/click to toggle instead.
- Form inputs — Use appropriate input types (
type="email",type="tel",type="number") to trigger the correct mobile keyboard. Setautocompleteattributes to speed up form fills.
Viewport configuration
The viewport meta tag is the foundation of mobile responsiveness. Without it, mobile browsers render your page at a desktop width and zoom out, making everything tiny:
<meta name="viewport" content="width=device-width, initial-scale=1">
Critical rules:
- Never disable user scaling — Avoid
maximum-scale=1oruser-scalable=no. Users with low vision need to zoom in. Disabling zoom also fails WCAG accessibility guidelines and can hurt your Google ranking. - Avoid fixed widths on the body/html — Setting
width: 1024pxon the body forces horizontal scrolling on mobile. Usemax-width: 100%on images and containers. - Handle overflow — Add
overflow-x: hiddenon the body only as a last resort. Instead, find and fix the element that's causing horizontal scroll. Common culprits: images withoutmax-width,preelements, and absolute-positioned elements.
Testing on real devices
Browser DevTools device emulation is a starting point, but it can't catch everything. Real device testing reveals issues with:
- Touch behavior — Scroll momentum, pinch-to-zoom, double-tap zoom, and swipe gestures behave differently than mouse simulation.
- Performance — Real phones have slower CPUs and less memory than your development machine. A page that feels fast on your MacBook might take 5 seconds to become interactive on a mid-range Android phone.
- Browsers — Test on Chrome (Android), Safari (iOS), Samsung Internet, and Firefox. Safari on iOS has unique quirks with viewport height (
100vhincludes the address bar), position sticky, and date inputs. - Network conditions — Use Chrome DevTools throttling to simulate 3G and 4G connections. Your users aren't always on WiFi.
At minimum, test on one recent iPhone (Safari) and one mid-range Android phone (Chrome). These cover the vast majority of real-world usage.
Frequently Asked Questions
Related Articles
Check how your website performs in this area
Get Your Growth Score