Overview
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.
Why Does Responsive Mobile Horizontal Scroll Issue Happen?
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?
You can check this video tutorial for more visualization:
-
Step 1: Open the Custom Code Editor
Navigate to the bottom left corner, hover over it to see the feature Add custom Code popping up, and make a left-click.
Step 2: Paste the Custom CSS code
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.
Tips And Best Practices
- 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 Questions
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.