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.

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.

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

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

Latest From Divi Booster

Enable Automatic Looping for YouTube Videos in the Divi Video Module

Enabling automatic looping for YouTube videos in your Divi video module ensures that content plays seamlessly and continuously without interruption. This feature can enhance user engagement, highlight key information, or create dynamic visual effects on your website....

Hide Video Controls in Divi Video Module

Disabling YouTube video controls in the Divi Video Module helps create a seamless, distraction-free viewing experience for your site visitors. This approach is useful when you want full control over how your video content appears and is interacted with on the page, or...

Mute YouTube Videos by Default in the Divi Video Module

In the Divi Video Module, starting your YouTube videos muted by default can create a more user-friendly browsing experience on your webpage. It is particularly beneficial for reducing distractions, enhancing visitor engagement, and providing a seamless content preview...

Autoplay Videos in Divi Video Module

Enabling videos in your Divi video module to start playing automatically can enhance both the site's design and user engagement. To ensure full compatibility with browser requirements, such as Chrome's autoplay policy, it's often necessary to start your videos muted...

How to Add the Post Status in Divi's Dynamic Content

Divi's Dynamic Content feature is great for enhancing your post/page templates with post-specific information. While Divi includes an option to show information such as the Post Created Date using Dynamic Content, there is no equivalent option for the Post Status....

Random Divi Posts