UndieGravity LogoUndiegravity

Mobile First Responsive Design: A Practical Guide

Design for phones first, then scale up: the viewport tag, fluid layouts, breakpoints that follow content, touch targets, and testing on real devices.

By UndieGravity, , 2 min read

Mobile first means you write the base styles for a small screen, then add rules as the screen gets wider. It leads to simpler CSS and better phone experiences, and phones are where most visits come from for most sites.

Start with the viewport tag

<meta name="viewport" content="width=device-width, initial-scale=1">

Without it, phones render the page at desktop width and shrink it down, and none of your responsive CSS takes effect. Do not disable zoom; some visitors need it.

Fluid by default

  • Use percentages, fr units, and max-width instead of fixed pixel widths.
  • Set img { max-width: 100%; height: auto; } so images never overflow.
  • Limit text width to about 65 to 75 characters with max-width: 65ch for comfortable reading.

Breakpoints follow your content

Do not pick breakpoints from a list of device sizes. Make the browser window wider until the layout looks stretched or broken, and add a breakpoint there.

.features {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .features { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .features { grid-template-columns: repeat(3, 1fr); }
}

Design for thumbs

  • Make tap targets at least 44 by 44 pixels, with space between them.
  • Put the main action where a thumb can reach it, often near the bottom.
  • Use inputs with the right type (email, tel, number) to get the right keyboard.
  • Do not rely on hover; touch screens do not have it.

Five or fewer links can often stay visible. More than that usually goes behind a menu button. Make sure the menu opens with a real <button>, closes with Escape, and keeps focus inside while open.

Avoid horizontal scrolling

A page that scrolls sideways on a phone feels broken. Common causes: a fixed width element, long words or URLs, wide tables, and 100vw widths that ignore the scrollbar. For tables, wrap them in a container with overflow-x: auto or turn rows into cards.

Test on real devices

Browser device modes are good for layout, but test on at least one real phone for touch, scrolling, and speed. Open your local dev server on a phone on the same Wi-Fi using your computer's local IP address.

Keep reading

HTML and CSS

CSS Grid vs Flexbox: When to Use Each

Flexbox lays out items in one direction; CSS Grid lays out rows and columns together. Real examples of navbars, card grids, and page layouts with each.

, 1 min read