Build responsive web apps by letting content and available space drive the layout—not by designing for a fixed list of devices. Start with a mobile viewport declaration, use flexible Grid and Flexbox layouts, introduce breakpoints when the content needs them, and make reusable components respond to their own container. Then deliver appropriately sized images and test accessibility and field performance across mobile and desktop.
Start with the document and content
Responsive work starts with the content hierarchy, reading order, controls, and the space they need. A narrow screen is not simply a desktop canvas scaled down: it may require a different arrangement, but information and controls should remain understandable and reachable.
Include a viewport declaration in the document head so mobile browsers use the device width as the layout viewport:
<meta name="viewport" content="width=device-width, initial-scale=1">
Without it, some mobile browsers may lay out a page against a wider virtual viewport and scale the result down. Do not disable zoom with restrictive viewport settings; people who need magnification must still be able to zoom. See web.dev’s responsive layout guidance.
#1 Best Overall
Build fluid layouts before adding breakpoints
Use flexible tracks and items so a layout can adapt continuously within the available width. Grid is a natural fit for two-dimensional arrangements and repeatable tracks; Flexbox works well when items need to distribute or wrap in one row or column. Avoid fixed widths that force horizontal scrolling when text grows, translations expand, or a viewport narrows.
.page {
width: min(100% - 2rem, 72rem);
margin-inline: auto;
}
.product-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
gap: 1.25rem;
}
.toolbar {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem;
}
The grid example allows columns to fit when space permits and fall into fewer columns when it does not. The toolbar can wrap rather than forcing its controls off-screen. Choose track minimums and gaps based on the actual content and control sizes your app needs.
Use content-led breakpoints
Begin with the narrow layout, then widen the viewport until the content becomes cramped, overly spread out, or otherwise harder to use. Add a breakpoint where a meaningful composition change improves the experience. A breakpoint is a response to a layout constraint, not a declaration that a particular brand of phone or tablet has arrived.
.article-layout {
display: grid;
grid-template-columns: 1fr;
gap: 2rem;
}
@media (min-width: 52rem) {
.article-layout {
grid-template-columns: minmax(0, 2fr) minmax(14rem, 1fr);
}
}
The value here is an example for this layout, not a universal breakpoint. The 600px value discussed in web.dev’s guide is likewise an illustration of one component’s content, not a recommended breakpoint for every app. Keep line lengths, control widths, and content density—not device categories—as the deciding factors.
Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Choose the right scope for adaptation
Viewport media queries for page composition
Use media queries when the overall page composition should change with the viewport. They can also respond to capabilities such as pointer precision or hover support. Do not assume a large display always has a mouse or that every small display is touch-only; hybrid devices make those assumptions unreliable. Where useful, adapt interaction affordances to the capability rather than to screen width alone:
@media (hover: hover) and (pointer: fine) {
.menu-button:hover {
text-decoration: underline;
}
}
Container queries for reusable components
A component may appear in a narrow sidebar on one page and a wide main column on another. A viewport query couples its layout to the whole screen, even though the relevant constraint is the space the parent gives it. Establish a query container and style its descendants with @container:
.card-region {
container-type: inline-size;
}
.card {
display: grid;
gap: 1rem;
}
@container (min-width: 34rem) {
.card {
grid-template-columns: 10rem minmax(0, 1fr);
align-items: start;
}
}
Use an appropriate containment context for the dimension being queried. If container query support does not meet your project’s browser requirements, retain a usable Grid or Flexbox layout as a fallback. For syntax and support considerations, see MDN’s CSS container queries guide.
Make responsive images a delivery decision
CSS constraints stop an image from overflowing, but shrinking one large source does not necessarily reduce the bytes transferred. Set images to fit their container, preserve their ratio, and provide intrinsic dimensions so the browser can reserve space before the image decodes:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #3
img,
video,
iframe {
max-inline-size: 100%;
}
img {
block-size: auto;
}
<img
src="team-800.jpg"
width="800"
height="533"
alt="The product team reviewing a design on a screen"
>
Offer suitable source sizes
Use width-descriptor candidates in srcset and describe the rendered slot with sizes. This gives the browser a choice among resource sizes rather than making CSS scaling do all the work:
<img
src="dashboard-800.jpg"
srcset="dashboard-400.jpg 400w,
dashboard-800.jpg 800w,
dashboard-1400.jpg 1400w"
sizes="(min-width: 72rem) 48rem,
(min-width: 52rem) 66vw,
100vw"
width="1400"
height="900"
alt="Analytics dashboard showing weekly activity"
>
Make the sizes description reflect the image’s real layout slot; inaccurate values can lead the browser to select an unsuitable candidate. Use <picture> when art direction calls for different imagery or crops at different conditions, not merely to repeat sources the browser could already choose from srcset.
Set loading priority deliberately
Lazy-load images that are below the fold when delaying them is appropriate. Do not indiscriminately lazy-load the prominent image users need immediately; that can delay its appearance. High fetch priority is for a genuinely critical image only, since elevating one resource can take priority from others. Do not preload every image or asset. For image sizing, loading, art direction, and semantics, consult web.dev’s responsive images guide.
Keep image alternatives meaningful
Write useful alt text for informative images. For an image that is purely decorative and adds no information, use alt="". Omitting the attribute is not the same instruction to assistive technology as marking the image decorative.
Recommended Free Tools
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Test behavior, accessibility, and performance
A screenshot at one width cannot establish that an app is responsive or accessible. Test a range of widths and input conditions, and check how real content behaves when it wraps or changes layout.
- Check for clipped content and horizontal scrolling at narrow and wide widths.
- Zoom in and verify that text and controls remain available without losing content.
- Rotate the viewport and confirm that layout changes do not strand controls.
- Navigate with a keyboard, checking focus order and whether every action remains reachable.
- Try interactions with coarse and fine pointers, and with and without hover capability.
- Review layouts with the assistive technologies and browsers that matter to your audience.
There is no single device-and-assistive-technology test matrix prescribed for every app. Set coverage according to your audience and supported browser policy rather than assuming a few viewport screenshots are sufficient.
Measure field experience, not just appearance
Core Web Vitals cover loading, interactivity, and visual stability through Largest Contentful Paint (LCP), Interaction to Next Paint (INP), and Cumulative Layout Shift (CLS). The recommended “good” thresholds in web.dev’s Web Vitals guidance, last updated 2024-10-31, are LCP within 2.5 seconds, INP at or below 200 milliseconds, and CLS at or below 0.1. Evaluate them at the 75th percentile, with mobile and desktop assessed separately. These are field thresholds, not a guarantee that any individual visit will meet them; consult the maintained guidance for current definitions and recommendations.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Capture responsive states without relying on memory
After validating layouts in a browser, save representative viewport captures alongside code or bug reports. Compare a narrow layout, a breakpoint transition, and a wide layout; include states where content wraps or a component is placed in a different container. A screenshot helps review visible differences, but it does not replace keyboard, zoom, assistive-technology, or field-performance checks.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Best Value
For browser-based checking, use your browser’s responsive design or device emulation tools to vary viewport dimensions and inspect the rendered page. Test at widths derived from your content constraints, not only at named device presets. If you need a repeatable capture for a publicly reachable page, an API can automate the image step.
Or skip the browser setup
ScreenshotNeo can capture a page through one GET request, including with device presets or a custom viewport. Cookie and consent banners, newsletter popups, and chat widgets are handled before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.
For repeatable viewport captures, change the URL and viewport options to match your app. See the ScreenshotNeo API documentation for request parameters and available options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Sign up free for ScreenshotNeo.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




