Preventing the Divi Theme Horizontal Scroll-Bar Bug

Written by Dan Mossop

There is a minor bug in the Divi Theme which causes the horizontal scroll bar to be shown and allows the user to scroll a little bit past the edge of the main blog. Here's how to fix it.

First, an example of what I'm talking about.

divi theme scroll bar bug

Notice that the horizontal scroll bar is showing, and that having scrolled as far as I can go, I'm now slightly off the side of the page and can see the edge of the header bar.

It took me a while to track down the culprit. All the visible components of the screen were correctly staying within the bounds of the normal screen size. The offending component, then, had to be something invisible! Turns out it is the drop-down submenu which causes the problem, as can be seen here:

divi theme scroll bar bug - submenu

So how do we fix the issue? It's as simple as adding the following CSS to the theme:

#page-container { overflow:hidden; }

This forces the part of the menu which spills over the page to be hidden from view. The result is that the horizontal scroll bar is no longer shown and you can't scroll past the edge of the screen.

Here's the final result. Notice the lack of horizontal scroll bar this time:

divi theme scroll bar bug - fixed

The fix doesn't seem to cause an issue actually accessing the menus. But be sure to check on your own site just to be sure.

Supercharge Your Posts with AI-Driven CTAs

Resolve issues like the Divi horizontal scroll bar bug while boosting your site's engagement. Use WP Magic CTAs to transform each post with AI-generated call-to-actions that increase conversions effortlessly. Perfect for directing users to helpful resources after solving technical glitches.

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

34 Comments

  1. Thanks! This worked great!

    Reply
    • You're welcome, Renzo!

      Reply
  2. For anyone who still is seeing a scroll bar on mobile – add this to your theme CSS:

    html, body {
    overflow-x: hidden;
    }
    body {
    position: relative
    }

    I got this from stackoverflow and it solved my problems!!

    Reply
    • Thanks Naf! Yeah, that should do it :)

      Reply
  3. That worked flawlessly. Thank you so much.

    Reply
    • Great! Glad it helped, Josepha.

      Reply
  4. It Works well, but bot in mobile. There's somethimg to do?

    Reply
    • Hey Renato, is there any chance you're able to share a link to the site you're working on? There's probably some element on the page which is protruding off the edge of the screen at mobile widths. If I'm able to take a look at the site I'll hopefully be able to tell you what that item is / what to do about it. Thanks!

      Reply
  5. Incredibly helpful! Thanks for sharing!

    Reply
    • You're welcome, Steve!

      Reply
  6. Amazing! I had gone over the pages and the header and footer again and again trying to figure out what was going on. Thank you!

    Reply
    • You're welcome, Anna!

      Reply
  7. legend

    Reply
  8. you absolute rockstar!

    Reply
    • :)

      Reply
    • Hi Agustin, you can add it into the "Divi > Theme Options > General > Custom CSS" box, or alternatively the style.css file of your child theme (if you're using one). I hope that helps!

      Reply
  9. <3

    Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.

We may earn a commission when you visit links on our website.

Latest Posts

Set Custom CSS IDs for Individual Divi Accordion Items

Assigning unique CSS IDs to specific Divi Accordion items allows for precise control over styling, targeting, and linking within your page content. This ability is particularly useful when you want to apply custom designs or create anchor links to particular accordion...

Enable Swipe Navigation in the Divi Gallery Lightbox

Enabling swipe navigation in the Divi Gallery module's lightbox allows users to seamlessly browse through gallery images by swiping left or right, creating a more interactive and mobile-friendly experience. This functionality can significantly improve user engagement...

Disable Slide-In Animation for Divi Gallery Grid Images

Control how images appear in your Divi Gallery module by toggling the slide-in animation effect for grid layouts. Disabling the slide-in animation allows gallery images to load instantly and appear statically, providing a faster and distraction-free browsing...

Control Image Count Display in Divi Gallery Lightbox

Displaying or hiding the image count in the Divi Gallery module’s lightbox can help customize the user experience, depending on whether you want to give visitors an indication of gallery progress or prefer a cleaner, distraction-free view. The ability to toggle this...

Hide Gallery Image Titles in the Divi Lightbox Overlay

Displaying image titles in the lightbox overlay of the Divi Gallery module can sometimes be distracting or unnecessary, depending on your website’s design and user experience goals. Hiding these titles creates a cleaner and more focused viewing experience for visitors...

Random Posts