Fast, crawlable mobile pages start in the codebase. This guide gives developers copy-ready HTML and CSS for the mobile issues that most affect rankings and conversions, with a way to verify each fix before it merges. If you own the marketing side, start with the mobile SEO checklist. For metric targets and prioritization, read Core Web Vitals for B2B sites.
Start With the Viewport Meta Tag
Without a viewport tag, mobile browsers render the page at desktop width and shrink it. Every template needs this in the head:
<meta name="viewport" content="width=device-width, initial-scale=1" />
Do not set maximum-scale=1 or user-scalable=no. Blocking zoom hurts accessibility and gains nothing for SEO.
Responsive Web Design for Mobile Compatibility
Responsive web design is the foundation of mobile SEO. It allows your website to adapt automatically to various screen sizes, ensuring a consistent and user-friendly experience across all devices.
Example of CSS Media Queries for Responsive Design:
/* Default styles for desktop */
.header {
font-size: 24px;
}
/* Media query for mobile devices */
@media (max-width: 768px) {
.header {
font-size: 18px;
}
}
By employing CSS media queries, you can modify styles based on the device’s screen width, creating a smooth transition from desktop to mobile.
Optimize Page Loading Speed for Mobile Devices
Page loading speed is crucial for mobile SEO, as users expect fast and efficient browsing on their smartphones. Compress images, leverage browser caching, and minify CSS and JavaScript files to reduce loading times.
| Image | Format | Original Size | Compressed Size | Load Time (approx.) |
|---|---|---|---|---|
| Image A | JPG | 500 KB | 100 KB | 1.5 seconds |
| Image B | PNG | 700 KB | 200 KB | 2 seconds |
| Image C | GIF | 300 KB | 80 KB | 1 second |
| Image D | WEBP | 400 KB | 90 KB | 1 second |
The table above is illustrative. Actual savings depend on the source image and settings.
Example of responsive, modern image delivery:
<picture>
<source
srcset="/img/hero-800.avif 800w, /img/hero-1600.avif 1600w"
type="image/avif"
/>
<img
src="/img/hero-800.jpg"
srcset="/img/hero-800.jpg 800w, /img/hero-1600.jpg 1600w"
sizes="100vw"
width="1600"
height="900"
alt="Project team reviewing plans on site"
fetchpriority="high"
/>
</picture>
Explicit width and height reserve space and prevent layout shift. Use fetchpriority="high" on the hero only, and loading="lazy" on images below the fold.
Mobile-friendly Navigation and Touch Elements
Ensure that your website’s navigation and touch elements are easily accessible and user-friendly on mobile devices. Avoid using small buttons and links too close together, as they can lead to accidental clicks.
Example of Touch-Friendly Buttons:
HTML:
<!-- Bad Example - Buttons too small for touch -->
<button class="small-button">Click Me</button>
<!-- Good Example - Larger, touch-friendly button -->
<button class="large-button">Click Me</button>
CSS:
/* Styling for the bad example - Small button */
.small-button {
font-size: 14px;
padding: 5px 10px;
background-color: #f1f1f1;
border: 1px solid #ccc;
border-radius: 4px;
color: #333;
}
/* Styling for the good example - Large button */
.large-button {
font-size: 18px;
padding: 10px 20px;
background-color: #007bff;
border: none;
border-radius: 6px;
color: #fff;
cursor: pointer;
}
Using Responsive Units in CSS for Mobile SEO
Embracing responsive units in CSS, such as percentages, em, and rem, is crucial for a mobile-friendly design. These units allow elements to adapt fluidly to different screen sizes, enhancing user experience and positively impacting mobile SEO.
| Responsive Unit | Description | Example |
|---|---|---|
| Percentages | Scale elements proportionally with containers | width: 100%; |
| Em Units | Relative to the font size of the parent element | font-size: 1.5em; |
| Rem Units | Relative to the root (html) font size | font-size: 2rem; |
Skip AMP and Optimize the Canonical Page
Older guides, including an earlier version of this post, recommended Accelerated Mobile Pages. AMP is no longer needed for mobile rankings, and maintaining a second template adds cost. Put the effort into the canonical page instead. Our post on Core Web Vitals and Mobile SEO for B2B Sites (Without AMP) explains how to retire AMP safely.
Test and Monitor Mobile Performance
To optimize your website’s mobile performance and enhance its SEO, consistently monitoring and evaluating its performance on mobile devices is crucial. By using Google PageSpeed Insights, you can obtain key metrics that reflect user experience and loading speed on mobile devices.
Keep two kinds of numbers apart. Core Web Vitals are field data from real visits, assessed at the 75th percentile of page loads, and they are part of Google’s page experience signals. The PageSpeed or Lighthouse performance score is a lab diagnostic for debugging, not a ranking signal.
| Core Web Vital | “Good” threshold (75th percentile) | What it measures |
|---|---|---|
| Largest Contentful Paint (LCP) | <= 2.5 seconds | Loading of the main visible content |
| Interaction to Next Paint (INP) | <= 200 milliseconds | Responsiveness to taps and clicks |
| Cumulative Layout Shift (CLS) | <= 0.1 | Visual stability while the page loads |
Lab tools measure LCP and CLS directly, but they cannot measure INP because it needs real interactions across a visit. In Lighthouse, Total Blocking Time is the lab proxy for responsiveness, so reduce TBT in the lab and confirm INP in field data. To debug a specific slow interaction, record it in the Chrome DevTools Performance panel. INP replaced First Input Delay as a Core Web Vital in March 2024, so update any older dashboards that still track FID. The Search Console Core Web Vitals report shows field data by URL group.
Serve the Hero Image First
The hero image is usually the largest element on a B2B page. Serve the right size for each screen, tell the browser to fetch it first and never lazy-load it.
<img
src="/img/hero-800.webp"
srcset="
/img/hero-480.webp 480w,
/img/hero-800.webp 800w,
/img/hero-1200.webp 1200w
"
sizes="(max-width: 600px) 100vw, 50vw"
width="1200"
height="675"
fetchpriority="high"
alt="Project dashboard showing pipeline by stage"
/>
Verify: in the Chrome DevTools Network panel, the hero image starts downloading in the first wave of requests.
Load Fonts Without Shifting the Layout
<link
rel="preload"
href="/fonts/brand-600.woff2"
as="font"
type="font/woff2"
crossorigin
/>
@font-face {
font-family: "Brand";
src: url("/fonts/brand-600.woff2") format("woff2");
font-display: swap;
size-adjust: 100%;
}
Use size-adjust and a close fallback font so the swap does not move text. Verify: text does not jump when the font loads on a throttled mobile profile.
Where Performance Metrics Fit
These fixes support fast loading and stable layouts on mobile. For which metrics to track, the thresholds that count as good and how to prioritize templates, read Core Web Vitals for B2B sites.
Pre-Merge Mobile SEO Checklist
- Viewport meta tag present, no
user-scalable=no - Every image has width, height and alt
- Hero image not lazy-loaded and has
fetchpriority="high" - Tap targets at least 48 by 48 CSS pixels with spacing
- Same primary content and structured data on mobile and desktop
- No content hidden behind tabs that only load on interaction
- Internal links are real
<a href>elements, not click handlers - Page returns 200 and a self-referencing canonical
- Lighthouse mobile run attached to the pull request