Responsive Mobile Horizontal Scroll Issue

OverviewClick to copy

Sometimes when you see your pages on the mobile, the page ends up with an undesired extra space to the right. (It slides from the left to the right). In this article, you will learn how to avoid this issue.

Responsive Mobile Horizontal Scroll Issue

Why Does Responsive Mobile Horizontal Scroll Issue Happen?Click to copy

Basically, the main reason for this issue happening is that the content of the page has a bigger width than the device’s width.

For example, the mobile device’s width is 375px, but there is an element having more than 375px, so you have to scroll horizontally to see the full element.

In some cases, if you set the negative margin-left and right for an element, it can cause this issue.

How To Fix Responsive Mobile Horizontal Scroll Issue?Click to copy

You can check this video tutorial for more visualization:

Navigate to the bottom left corner, hover over it to see the feature Add custom Code popping up, and make a left-click.

custom code editor

Step 2: Paste the Custom CSS codeClick to copy

And then, go to this link to get the code and paste it into the Custom CSS box like the image below

Click on the Save change button and publish the page to see the result.

Note: If the above code does not work, you can change it into this code. Please notice this CSS when the page has a sticky section or sticky header on mobile. This code will disable sticky sections.

Tips And Best PracticesClick to copy

  • Check Element Widths: Ensure no element exceeds the device’s width to prevent horizontal scrolling.
  • Avoid Negative Margins: Negative margins can cause overflow; use them cautiously.
  • Use Custom CSS: Apply custom CSS to fix issues with horizontal scrolling on mobile devices

Frequently Asked QuestionsClick to copy

1. What causes horizontal scrolling?

Content wider than the device’s screen, often due to oversized elements or negative margins.

2. How can I fix the scrolling issue?

Use the provided custom CSS code to correct the overflow problem.

Additional ResourcesClick to copy

Thank you for your feedback!

Navigate this category

Could not find the answer
to your question?

Chat with us
Great news! PageFly Help Center is now available in Japanese 🇯🇵. Explore now by switching the language in the Header section ☝️