Responsive WordPress theme design: a practical guide
How to build and check a responsive WordPress theme: viewport, fluid layout and type, images, touch targets, and how to test on real devices.
At a glance
A responsive theme adapts its layout to the screen it is shown on. Build mobile first, let content flow with grid, flexbox and clamp(), size images with srcset, width and height, make touch targets easy to hit, and test with Lighthouse and real devices at every width. This guide covers the building blocks, container queries, fluid type in block themes, accessibility and a pre-launch checklist.
Updated November 29, 2026 · For WordPress theme developers and designers
- For developers and designers building or checking a responsive WordPress theme
- Approach mobile-first CSS, fluid layout, fluid type with clamp() or theme.json
- Images srcset and sizes from WordPress, explicit width and height, no hard-coded full-size URLs
- Touch WCAG 2.2 sets a 24 CSS pixel minimum target size at AA
- Testing browser device mode, Lighthouse and at least one real iPhone and Android phone
- Note Google's standalone Mobile-Friendly Test has been retired
- Help theme development and design to WordPress services
On this page
A responsive theme adapts its layout to the screen it is shown on. Build mobile first, let content flow, size images properly, and test on real devices at every width.
Why does responsive design matter?
Visitors reach your site on every kind of screen, and search engines index the mobile version of your pages. A layout that needs pinching and sideways scrolling loses visitors and weakens search performance. Look at the device report in your analytics rather than assuming a split.
What are the building blocks?
| Block | What to do |
|---|---|
| Viewport tag | Output width=device-width, initial-scale=1; without it phones render at desktop width |
| Mobile-first CSS | Base styles for the smallest screen, then min-width queries |
| Fluid layout | Flexbox and grid with relative sizes, repeat(auto-fit, minmax(16rem, 1fr)) |
| Fluid type | clamp() or fluid sizes in theme.json; body text around 16px or larger |
| Images | srcset and sizes from WordPress, explicit width and height, max-width: 100%; height: auto |
| Navigation | Test the mobile menu with a finger and the keyboard |
| Touch targets | At least 24 CSS pixels at WCAG 2.2 AA, with space between links |
| Tables and embeds | Scrolling wrapper for wide tables; add_theme_support( 'responsive-embeds' ) |
<meta name="viewport" content="width=device-width, initial-scale=1">.cards { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 40em) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64em) { .cards { grid-template-columns: repeat(3, 1fr); } }
h1 { font-size: clamp(1.75rem, 1.2rem + 2.5vw, 3rem); }Choose breakpoints where your content breaks, not at particular devices' sizes. For images, register sensible sizes with add_image_size(), do not hard-code full-size URLs and keep the main image above the fold from being lazy loaded.
How do I do fluid type and container queries?
Block themes can generate fluid font sizes from theme.json, so there is no clamp() to hand-write:
{
"version": 3,
"settings": {
"typography": {
"fluid": true,
"fontSizes": [
{ "slug": "large", "name": "Large", "size": "2rem",
"fluid": { "min": "1.5rem", "max": "2.5rem" } }
]
}
}
}WordPress converts that into a clamp() value between the smallest and largest viewport width. Check the result at both extremes.
Write clamp() in your stylesheet, as in the example above. Keep body text readable and limit line length.
A card can switch from stacked to side by side based on the space it has:
.card-wrap { container-type: inline-size; }
.card { display: grid; gap: 1rem; }
@container (min-width: 32rem) {
.card { grid-template-columns: 12rem 1fr; }
}The stacked layout is the default, so a browser without support still shows a usable card.
How do I test it?
- Drag the browser window
slowly from narrow to wide and watch for awkward in-between states.
- Use DevTools device mode
for quick checks, including slow network and touch.
- Use real devices
at least one iPhone and one Android phone, and a tablet if you can.
- Run Lighthouse,
which checks the viewport, tap targets and performance.
- Rotate the device
Landscape phones expose fixed headers that eat the screen.
- Zoom to 200%
and check nothing breaks.
Google retired its standalone Mobile-Friendly Test tool, so Lighthouse and real-device testing are the dependable checks. See browser testing a WordPress theme.
What are the common mistakes?
- Fixed pixel widths on containers or images.
- Hiding content on mobile, which also hides it from mobile-first indexing.
- Huge background images or sliders that load on a phone connection.
- Pop-ups and sticky bars that cover the screen on a phone.
- Text in images, which does not scale or translate.
- Forgetting the admin bar, which shifts a fixed header for logged-in users.
What about accessibility on small screens?
Check these on a phone, not only a desktop: text stays readable zoomed to 200%, focus outlines are visible on every control including the menu button, the mobile menu opens and closes from the keyboard with Escape closing it, contrast holds on every background including images behind text, nothing relies on hover, and motion respects the reduced-motion setting by wrapping non-essential animation in @media (prefers-reduced-motion: no-preference).
What is the pre-launch checklist?
| Check | Pass when |
|---|---|
| Viewport tag present | The page renders at device width on a phone |
| No sideways scroll | Nothing is wider than the screen at 320 px |
| Images sized | Each has width and height and loads an appropriate size |
| Tap targets | Buttons and links are easy to hit with a thumb |
| Menu | Works by touch and keyboard |
| Forms | Fields are large enough, with the right keyboard type on mobile |
| Speed | The main content appears quickly on a throttled connection |
| Admin bar | The header still works for logged-in users |
A worked example of fixing one layout
A services grid shows four cards in a row on desktop and overflows on a phone because each card has a fixed width. Replace the fixed widths with a grid using repeat(auto-fit, minmax(16rem, 1fr)): the row collapses to one column on a phone and expands naturally, without a media query. If the card images use fixed dimensions, give them max-width: 100%; height: auto; and explicit width and height attributes to avoid layout shift.
Our developers build pixel-faithful themes.
See also our theme development service.
Is a responsive theme still needed now?
Yes. Visitors arrive on phones, tablets, laptops and large monitors, and Google indexes the mobile version of your pages. A theme must work at every width.
Link to this answerDo I need media queries for everything?
No. Modern CSS such as flexible grids, clamp() for fluid type and container queries removes many breakpoints. Use media queries where layout truly changes.
Link to this answerWhere do I check how my site looks on mobile?
Use browser device emulation to check widths and a real phone for touch and performance. Google's own Mobile-Friendly Test tool has been retired, so rely on Lighthouse and real devices.
Link to this answerWhy does my page look zoomed out on a phone?
The viewport meta tag is probably missing, so the phone renders at a desktop width and shrinks it. Make sure the theme outputs width=device-width, initial-scale=1.
Link to this answerWhat does mobile-first CSS mean?
Write the base styles for the smallest screen and add rules with min-width media queries as space allows. It keeps phone CSS light and avoids undoing desktop rules.
Link to this answerWhere should I put breakpoints?
Where your content breaks, not at the sizes of particular devices. Drag the browser window slowly from narrow to wide and watch for awkward in-between states.
Link to this answerHow do I set fluid type in a block theme?
Turn on fluid typography in theme.json and give each font size a fluid min and max. WordPress converts that into a clamp() value, but check the result at both extremes.
Link to this answerWhat are container queries?
They let a component respond to the width of its container instead of the screen, so a card can lay itself out differently in a wide column and a narrow sidebar. Give older browsers a sensible default layout.
Link to this answerHow big should touch targets be?
WCAG 2.2 sets a minimum of 24 CSS pixels for target size at level AA, and larger is easier to use. Leave space between neighbouring links.
Link to this answerShould I lazy load the main image?
No. WordPress adds lazy loading to most images, but the main image above the fold should not be lazy loaded because it delays the most important paint.
Link to this answerWhat are common responsive mistakes?
Fixed pixel widths, hiding content on mobile (which also hides it from mobile-first indexing), huge backgrounds or sliders, covering pop-ups, text in images and forgetting the admin bar shifting a fixed header.
Link to this answerCan WP24x7 turn my design into a responsive theme?
Yes. See the design to WordPress and theme development services for a pixel-faithful responsive build.
Link to this answerKeep reading
Want an engineer on it?
Tell us what is wrong in plain words. A person reads it, today.