A website usually looks wrong on mobile because its layout assumes more space than the screen provides, its viewport is configured incorrectly, or a component cannot adapt to the available width. Find the element causing the problem before applying a site-wide overflow rule.
Responsive design is more than shrinking a desktop screenshot. The content must remain readable, controls must remain usable, and important information must stay available.
Describe the symptom before changing CSS
Test the actual page that fails, with realistic text and images. Note whether the problem occurs on all narrow screens, one orientation, one browser, or only after opening the menu.
| Symptom | Likely area to inspect |
|---|---|
| The whole desktop page appears tiny | Viewport metadata and fixed desktop-width assumptions. |
| The page scrolls sideways | A wide element, long unbroken text, absolute positioning, or a fixed-width component. |
| Text overlaps or disappears | Fixed heights, positioning, line-height, and font loading. |
| The menu covers the logo or content | Header layout, available space, stacking, and open-state behaviour. |
| A form is difficult to complete | Field sizing, labels, keyboard behaviour, and error placement. |
Check the viewport and flexible sizing
A typical responsive page includes the following viewport declaration in the document head:
<meta name="viewport" content="width=device-width, initial-scale=1">
Do not disable user zoom to hide sizing problems. Someone may need larger text or magnification. The layout should tolerate those changes.
Inspect containers with a fixed width such as width: 1200px. A maximum width can preserve a comfortable desktop layout while allowing the container to shrink. The exact values depend on the design; the following is an illustrative pattern, not a universal site standard.
.content {
width: calc(100% - 2rem);
max-width: 72rem;
margin-inline: auto;
}
img {
max-width: 100%;
height: auto;
}
Find the element causing horizontal overflow
In developer tools, inspect the region extending beyond the viewport. Temporarily disable suspicious width or positioning rules and observe whether the overflow disappears. Make the smallest change that addresses the cause.
For more context, read our guide to understanding the layers of a website.
Flex and grid children can also resist shrinking when their content has a large intrinsic width. Depending on the layout, min-width: 0 on the relevant child can help. Long URLs may need wrapping. Tables and code examples may need their own labelled scroll container.
A blanket overflow-x: hidden can conceal the symptom while clipping content or controls. Use it only when the clipped content is intentionally nonessential and you have checked the consequences.
Test navigation as an interaction
Open and close the menu repeatedly. Try a keyboard. Check the button’s accessible name and expanded state. Confirm that links remain reachable and that the menu does not trap scrolling or hide its own close control.
A long logo or translated label can consume more space than a short placeholder. Test with the content you will publish. If the header needs a different arrangement at a certain width, choose the breakpoint where the content stops working, rather than assuming every device fits one standard category.
Make images and text survive real content
Use images with dimensions and a display strategy appropriate to their role. Cropping can work for a decorative thumbnail, but it may remove essential information from a diagram. Do not force every image into the same crop without checking it.
You can also explore our guide to diagnosing a site that works locally but fails online.
Replace rigid text-box heights with content-driven sizing where possible. Check long headings, error messages, and increased text size. A layout that works only with one short sentence is not ready for general content.
Use emulation, then a real device
Browser emulation is useful for testing many widths quickly. It does not reproduce every behaviour of a physical device, mobile keyboard, in-app browser, or touch interaction.
- Check at a narrow width and an intermediate tablet-sized width.
- Rotate a real phone and open the navigation.
- Complete a form, including an invalid submission.
- Increase text size or zoom where supported.
- Check the page after images and fonts finish loading.
Retest neighbouring widths after a fix. The goal is not one perfect screenshot at one device size; it is a layout that remains understandable and usable as available space changes.
Sources and further reading
Technical references checked during preparation on 13 November 2026. Examples and suggested workflows are editorial explanations, not reported client results.


