Layout bug · Fix guide

Elements Overlapping on Mobile? Why It Happens and How to Fix It

Updated October 22, 2026

Elements overlap on mobile when something is positioned or sized for a desktop screen and does not move when the layout stacks. The usual causes are absolute positioning, fixed heights on containers, negative margins, sticky headers covering content, and z-index stacking. Remove the fixed height or position on mobile and let the content flow.

Quick diagnosis

  • Text spills over the next section: a container has a fixed height, so content overflows it.
  • Heading sits on top of an image: absolute positioning tuned for desktop.
  • Top of the page is hidden under the menu: a fixed or sticky header without matching top padding.
  • Something covers a button only on some pages: a banner, chat bubble or badge with a high z-index.

Causes and fixes

1

Fixed heights on containers

Most common

A hero or card set to height: 500px looks fine on desktop. On a phone the text wraps to more lines, needs more height, and spills out over the next section.

Fix: Replace height with min-height (or remove it) so the box grows with its content.

2

Absolute positioning

Text placed over an image with position: absolute and pixel offsets stays at those offsets while the image shrinks, so it lands on the wrong part of the image or outside it.

Fix: On mobile, switch the overlay back to position: static inside a media query, or use CSS grid to stack image and text in the same cell.

3

Sticky or fixed headers covering content

A fixed header takes the top 60 to 100 pixels of the screen. Anchor links and the first section scroll underneath it, hiding headings and buttons.

Fix: Add top padding equal to the header height, and scroll-margin-top on anchor targets so jump links land below the header.

4

Negative margins

Overlapping cards built with margin-top: -80px look intentional on desktop but collide with stacked content on mobile.

Fix: Reset negative margins to 0 in your mobile breakpoint.

5

Floating widgets and z-index

Chat bubbles, review badges, back-to-top buttons and cookie banners use high z-index values. On a small screen they sit on top of the Add to cart or Submit button.

Fix: Move floating widgets clear of primary buttons on mobile, reduce their size, or hide non-essential ones below 480px.

6

Flexbox items that cannot shrink

Flex children with a fixed flex-basis or min-width refuse to shrink and get pushed over neighbours or out of their row.

Fix: Allow wrapping with flex-wrap: wrap and set min-width: 0 on flex children that contain long text.

How to find it on your site

  1. 1

    Check at three widths

    View the page at 375px, 768px and 1024px in DevTools device mode. Overlaps often appear only at tablet widths, between two breakpoints.

  2. 2

    Inspect the overlapping element

    Right-click the element that is on top and choose Inspect. Look for position: absolute or fixed, a height value, or a negative margin in the Styles panel.

  3. 3

    Toggle the rule

    Untick the suspicious rule in DevTools. If the overlap disappears, you have found the cause and can override it in a mobile media query.

  4. 4

    Test with real content

    Overlaps often come from longer content than the design used. Test your longest product name and heading, and with the phone's text size increased.

Fixes by platform

Shopify

Image-with-text-overlay sections and slideshow captions are the usual culprits. Most themes have a separate mobile layout setting for these sections; set the text to appear below the image on mobile.

WordPress

Elementor and Divi absolute-position settings and per-device margins carry over unless overridden. Open the responsive mode, select the element, and reset position and margin on mobile.

Wix and Squarespace

Wix positions elements absolutely by design, so desktop arrangements can collide on mobile. Rearrange in the mobile editor, and in Squarespace Fluid Engine adjust the mobile grid separately.

Custom code

Prefer grid and flex layouts over absolute positioning, and add visual snapshot tests at mobile and tablet widths so overlaps fail a pull request.

Frequently asked questions

Why are elements overlapping on my website on mobile?

Usually because a container has a fixed height that the wrapped mobile text overflows, or because an element is absolutely positioned with desktop offsets. Fixed headers, negative margins, and floating widgets with high z-index values are the other common causes.

How do I stop text overlapping an image on mobile?

Remove the absolute positioning on small screens with a media query so the text sits below the image, or use CSS grid to stack both in the same cell with the text constrained inside it.

Why does my header cover content when I scroll?

A fixed or sticky header sits above the page. Add top padding to the page equal to the header height, and scroll-margin-top to anchor targets so linked sections are not hidden underneath it.

Why do elements overlap only on tablet?

Tablet widths often fall between a theme's mobile and desktop breakpoints, so desktop positioning applies to a screen that is too narrow for it. Test at 768px and 1024px, not only at phone width.

Can a cookie banner block my checkout?

Yes. A banner fixed to the bottom of the screen can cover cart totals or checkout buttons on phones. Keep banners compact, make them dismissible, and test the cart and checkout pages with the banner visible.