Use an "App-Style" Header Layout for Divi on Mobiles

Written by Dan Mossop

The Divi Theme's header dynamically modifies itself to look good on small devices, such as smart phones. Here's how to make it look a little bit better.

If you leave (or set) the Divi header as the "Default" header style, it will look like this:

divi theme mobile header

Depending on the size of the mobile device's screen, the logo and menu box will vary in distance from the edge of the screen. If you'd like a more consistent appearance across devices, we can set the components to appear at a fixed distance from the edges, using the following CSS:

@media only screen and ( max-width: 980px ) {
    #main-header .container { 
        width:100%;
        box-sizing:border-box;
        padding-right:30px;
        padding-left:30px;
    }
    #main-header .logo_container {
        width: auto;
    }
    #main-header #logo {
        max-width: 100%;
    }
}

Note that this will only work for the "Default" header style, not others such as the "Centered" style.

Here's how it looks with the fix applied.

divi theme mobile header-adjusted

Note that the distance of the logo and menu bar will be the same in all devices, rather than changing as it does in the default configuration.

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

Transform Your Mobile Header Layout with CSS

Enhance your Divi Theme's mobile header design by maintaining a consistent appearance across various screen sizes. This guide provides CSS tweaks to fix the distance of the logo and menu bar from the screen edges, ensuring a polished look for your site's "Default" header style on smartphones.

Latest Posts

Hide Navigation Arrows in the Divi Gallery Slider Layout

Create a cleaner, distraction-free gallery by hiding the navigation arrows in Divi’s Gallery module when using the Slider layout. This is ideal when you want images to take center stage, reduce visual clutter, or rely on gesture or keyboard navigation instead of...

Customize Lightbox Title Styling in the Divi Gallery Module

Adjust the appearance of the lightbox title that appears when visitors open images from a Divi Gallery to align with your brand and improve readability. Refining the title’s color, size, and weight enhances visual hierarchy, accessibility, and overall polish. In this...

Center the Lightbox Image Count in the Divi Gallery Module

Centering the image count in a gallery lightbox creates a cleaner, more balanced presentation and makes it easier for visitors to see where they are in the image set. This simple visual tweak can enhance readability, especially with larger images and longer captions,...

Style the Divi Gallery Module Lightbox Image Count

Tailor the appearance of the image counter in the Divi Gallery module lightbox to match your brand and improve readability. By customizing the counter’s color and typography, you ensure it displays clearly and suits your design. In this guide we show you how to style...

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, 

5 Comments

  1. Thanks for this. Please I'm having issues with my logo, it's very small and almost non-visible. I have tried adjusting the primary header settings and also the logo size, but nothing seems to work!!

    Reply
    • Hi Mandy, are you able to confirm / share a link to the site you're working on? I took a look at the site linked in your comment, but notice it's not a Divi site, so I'm not sure if that's the site you're referring to. Just in case it is, I was able to come up with a bit of rough CSS to increase the header / logo size:

      .navigation_container { height: 100px !important; }
      .themeLogoImg { height: 50px !important; }
      #myNavbar { margin-top: 16px; }
      

      The CSS 1) increases the height of the header, 2) increases the height of the logo, and 3) moves the menu links down a bit to center them on the newly expanded header. If that is indeed the site you're working on, let me know and I'll try to refine this a bit. Cheers!

      Reply
  2. Hello,

    When I enable this option it makes the primary menu bar expand longer than the browser window so it creates a horizontal scrolling bar and white space down the side of the page:

    http://i.imgur.com/x8TW45f.jpg

    Thanks

    Reply
    • I just added the following to the div.logo_container and it has fixed it not sure if this is the best method?

      padding-left: 30px;
      padding-right: 30px;
      margin-left: -30px;
      margin-right: -30px;

      Reply
      • Hi Andrew, thanks for getting in touch and for sharing your solution. The issue seems to be occurring because Divi is now setting the logo_container to 100% width (which it didn't when I originally came up with the customization). I can't see any issues with your method, but a slightly simpler method is to set the width of the logo_container to "auto". That solves it without the need for padding / margin adjustments. I've updated the code in the post above to do this, and have fixed it in the next version of Divi Booster (2.5.7). Thanks again!

        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 *.