[Limited Time Offer] Get 40% off MEMBERSHIP PLUS before it's gone! 👉Get This Deal
Mark Hendriksen Logo

How to Create a Custom Divi Header

Mark Hendriksen | August 7, 2024 | 20 Comments
Disclosure Note: Sometimes, I include links in my articles that can earn me money. It won't cost you anything, but it helps me pay for coffee ☕ so I can make more helpful content.

One of the coolest things you can do with Divi is create a custom header that not only looks amazing but also perfectly aligns with your brand’s identity. In this guide, we’re going to walk you through everything you need to know to craft a stunning custom header in Divi. Whether you’re a seasoned pro or a newbie, we’ve got you covered. Let’s get started!

Step-by-Step Guide to Creating a Custom Divi Header

In this tutorial, I provide a detailed, step-by-step guide to creating a custom Divi header. From initial setup to final touches, every step is explained with clear instructions and screenshots.

Before I jump into the step-by-step process, let’s take a sneak peek at the final result.

This is the header we are going to create. It features a top bar with three columns: social media icons on the left, a tagline in the middle, and some text links on the right. Below the top bar, you’ll find our logo on the left, the menu in the middle, and a call-to-action button on the right.

Prefer watching over reading? Check out my comprehensive YouTube video tutorial below. In this video, I walk you through the entire process, making it easy to follow along and implement the steps on your own site.

Step 1: Add Global Header

Go to Divi > Theme Builder and click on Add Global Header.

Add Global Header

Then click on Build Global Header.

Build Global header

Step 2: Section Settings

Open the section and go to the Design tab.

Spacing

Set the top and bottom padding to 0px.

Go to the Advanced tab and under CSS Class place custom-header

Step 3: First Row

Add a new row for this Section and choose the 1/4 – 1/2 – 1/4 layout.

add a new row

Open this row and under Background set a color. I use color code #16264a.

Top row background color

Go to the Design tab.

Sizing

Enable “Use Custom Gutter Width” and set it to 0.

Set the Width and Max-Width to 100%.

Row design settings

Spacing

Set the top and bottom padding to 5px.

Set the left and right padding to 25px.

Top row padding

Go to the Advanced tab and under CSS Class place custom-top-row

Add a class to the top row

Step 4: Social Media Module

Place a social media follow module in the first column.

Open this module and place your social media networks here.

Then open each social media network and make the background color transparent.

Background color social media icon

Go back to the social media module settings and switch to the Design tab.

Alignment

Center the alignment for tablet and mobile.

Center social media for mobile

Icon

Enable “Use Custom Icon Size” and set the size to 13px.

Social media icon size

Go to the Advanced tab and place the class custom-social

Social media class

Step 5: Text Module Middle Column

Place a text module in the middle column.

Place a text module

In the text field place your text.

Place text

Go to the Design tab.

Text

Set the text font style to Uppercase.
Set the text color to white.
Set the text letter spacing to 1px.
Set the text alignment to the center.

Text settings

Step 6: Text Module Right Column

Place a text module in the right column.

Place your text links in the body field.

To create a vertical line hold ALT, then press 1, 2, and 4.

Text module with links

Go to the Design tab.

Text

Set the text color to white.
Set the text alignment to right.
Set the alignment to center for tablet and mobile.

text link color

Switch to the Link tab and set the link color to white.

Link tab

Step 7: Second Row

Add another row for this Section and choose the 1/4 – 1/2 – 1/4 layout.

Open this row and under Background set the color to white.

Second row background color

Go to the Design tab.

Sizing

Enable “Use Custom Gutter Width” and set it to 0.

Set the Width and Max-Width to 100%.

Row design settings

Spacing

Set the top and bottom padding to 15px.

Set the left and right padding to 25px.

Second row padding

Box Shadow

Under Box shadow select the third option.

And make the shadow color rgba(0,0,0,0.1)

Add a shadow to the row

Go to the Advanced tab and under CSS Class place custom-menu-row

Second row class

Visibility

Under visibility check disable on phone and tablet.

row visibility

Scroll Effects

Set the sticky position to “Stick to Top”. For tablet and mobile, I set this to “Do Not Stick”

Step 8: Image Module

Place an image module in the first column of the second row.

Open this module and place your logo in it.

Place a logo in the image module

Open the Link tab and place / in the link field. This will redirect the logo to your home page.

Logo link

Step 9: Menu Module

Place a menu module in the middle column.

menu module

Assign your menu.

Set your menu

Go to the Design tab.

Layout

Under style choose Centered.

Center menu

Text

Set the active and menu text color to black.
Set the font weight to semi-bold.
set the font size to 18px.

menu font settings

Dropdown menu

Set the dropdown menu line color to #910d0d

Go to the Advanced tab and under CSS Class place custom-menu.

Custom menu

Step 10: Button Module

Place a button module in the right column.

Place a button module

Place a title for your button.

Give the button a name

Go to the Design tab.

Alignment

Under alignment choose right.

Button alignment

Button

Enable “Use Custom Styles For Button”.
Set the font size to 16px.
Set the button text color to white.
Set the background color to #910d0d.
Set the border width to 0px.
Set the button font-weight to semi-bold.
Set the button font style to uppercase.
Disable the show button icon.

Button settings

Spacing

Set the top and bottom padding to 8px.
Set the left and right padding to 20px.

Button padding

Step 11: Tablet & Mobile Row

Add a new row and use a 1 column structure.

Row for tablet and mobile

Open the row settings and go to the Design tab, under sizing set the width and max-width to 100%.

Set row to 100 percent

Spacing

Set the top, bottom, left, and right padding to 15px.

Spacing padding

Go to the advanced tab and under Visibility check Desktop.

Hide row for desktop

Step 12: Menu module for tablet and mobile

Add a menu module to this row.

Content

Assign your menu.

Logo

Place your logo here.

Place a logo for your menu

Go to the Design tab.

Menu Text

Set the active and menu text colors.
Set the font size to 16px.

Mobile menu font settings

Dropdown Menu

Set the dropdown menu line color.

Mobile menu line color

Icons

Set the hamburger menu icon color.
Set the hamburger icon size to 40px.

Hamburger icon settings

Spacing

Set the bottom margin to 15px.

Mobile menu bottom margin

Step 13: Button Module for Tablet and Mobile

Duplicate the button module we created earlier and drag it below the menu for tablet and mobile.

Duplicate button

Open this button module and we are going to change the alignment.

Alignment

Change the alignment to center.

Change the button alignment

Go to the Advanced tab

Button class

Go to the Advanced tab and under CSS Class place button-mobile

Step 14: Add Custom CSS Code

Now we only have to place some CSS and jQuery code.

Go to Divi > Theme Options > CSS

CSS code

And place the following in there:

@media screen and (min-width: 981px) {
.custom-menu-row,
.custom-top-row {
  display: flex;
  align-items: center;
  justify-content: flex-end; 
}

/* #### Dropdown Menu #### */ 

.custom-menu li li a { 
  border-bottom: 1px solid #e5e5e5; /* #### Dropdown border bottom #### */ 
  font-weight: 600 !important; /* #### Dropdown font weight #### */ 
  font-size: 15px !important; /* #### Dropdown font size #### */ 
}
  
.custom-menu li li:last-child a { 
  border-bottom: 0px solid #e5e5e5; /* #### Dropdown border bottom #### */ 
}
  
.custom-menu ul.sub-menu {
  padding: 0px 0 0 0 !important;
  border-top-width: 2px; /* #### Dropdown border top width #### */ 
}

.custom-menu ul.sub-menu ul {
  padding: 0px !important;
}

.custom-menu li li ul {
  top: -2px !important;;
}

.custom-menu  li li {
  padding: 0px !important;
}

.custom-menu li li a {
  padding: 6px 20px;
  width: 240px !important;
}}

.custom-social li  {
  margin-bottom: 0px;
}

.button-mobile {
	width: 100%;
}

@media screen and (max-width: 980px) {
.custom-top-row .et_pb_column {
  margin-bottom: 0px !important;
}}

/* #### Collaping Mobile Menu #### */

ul.et_mobile_menu li.menu-item-has-children .mobile-toggle-icon::after,
.et-db #et-boc .et-l ul.et_mobile_menu li.menu-item-has-children .mobile-toggle-icon::after {
	color: #ffffff; /* Icon color */
	background: #16264a; /* Icon background color */
	font-size: 22px; /* Icon size */
	top: 10px;
	position: relative;
	font-family: "ETModules";
	content: '\33';
	border-radius: 4px;
	padding: 1px 2px 1px 0px;
}

.et_mobile_menu .menu-item-has-children>a {
    font-weight: 400 !important; 
}

ul.et_mobile_menu li.menu-item-has-children.mobile-toggle-open>.mobile-toggle-icon::after,
.et-db #et-boc .et-l ul.et_mobile_menu li.menu-item-has-children.mobile-toggle-open>.mobile-toggle-icon::after {
	content: '\32';
}

ul.et_mobile_menu li.menu-item-has-children .mobile-toggle-icon,
ul.et_mobile_menu li.page_item_has_children .mobile-toggle-icon,
.et-db #et-boc .et-l ul.et_mobile_menu li.menu-item-has-children .mobile-toggle-icon,
.et-db #et-boc .et-l ul.et_mobile_menu li.page_item_has_children .mobile-toggle-icon {
	width: 44px;
	height: 100%;
	padding: 0px !important;
	max-height: 44px;
	border: none;
	position: absolute;
	right: 0px;
	top: 0px;
	z-index: 999;
	background-color: transparent;
}

ul.et_mobile_menu>li.menu-item-has-children,
ul.et_mobile_menu>li.page_item_has_children,
ul.et_mobile_menu>li.menu-item-has-children .sub-menu li.menu-item-has-children,
.et-db #et-boc .et-l ul.et_mobile_menu>li.menu-item-has-children,
.et-db #et-boc .et-l ul.et_mobile_menu>li.page_item_has_children,
.et-db #et-boc .et-l ul.et_mobile_menu>li.menu-item-has-children .sub-menu li.menu-item-has-children {
	position: relative;
}

.et_mobile_menu .menu-item-has-children>a,
.et-db #et-boc .et-l .et_mobile_menu .menu-item-has-children>a {
	background-color: transparent;
}

ul.et_mobile_menu .menu-item-has-children .sub-menu,
#main-header ul.et_mobile_menu .menu-item-has-children .sub-menu,
.et-db #et-boc .et-l ul.et_mobile_menu .menu-item-has-children .sub-menu,
.et-db #main-header ul.et_mobile_menu .menu-item-has-children .sub-menu {
	display: none !important;
	visibility: hidden !important;
}

ul.et_mobile_menu .menu-item-has-children .sub-menu.visible,
#main-header ul.et_mobile_menu .menu-item-has-children .sub-menu.visible,
.et-db #et-boc .et-l ul.et_mobile_menu .menu-item-has-children .sub-menu.visible,
.et-db #main-header ul.et_mobile_menu .menu-item-has-children .sub-menu.visible {
	display: block !important;
	visibility: visible !important;
}

ul.et_mobile_menu li.menu-item-has-children .mobile-toggle-icon,
.et-db #et-boc .et-l ul.et_mobile_menu li.menu-item-has-children .mobile-toggle-icon {
	text-align: center;
	opacity: 1;
}

Step 15: Add jQuery Code

For the collapsing mobile menu we need to add some jQuery code.

Go to Divi > Theme Options > Integration > Add code to the < head > of your blog

Place the following in here:

<script>
jQuery(function($) {
    $(document).ready(function() {
        $("body ul.et_mobile_menu li.menu-item-has-children, body ul.et_mobile_menu  li.page_item_has_children").append('<a href="#" class="mobile-toggle-icon"></a>');
        $('ul.et_mobile_menu li.menu-item-has-children .mobile-toggle-icon, ul.et_mobile_menu li.page_item_has_children .mobile-toggle-icon').click(function(event) {
            event.preventDefault();
            $(this).parent('li').toggleClass('mobile-toggle-open');
            $(this).parent('li').find('ul.children').first().toggleClass('visible');
            $(this).parent('li').find('ul.sub-menu').first().toggleClass('visible');
        });
        iconFINAL = 'P';
        $('body ul.et_mobile_menu li.menu-item-has-children, body ul.et_mobile_menu li.page_item_has_children').attr('data-icon', iconFINAL);
        $('.mobile-toggle-icon').on('mouseover', function() {
            $(this).parent().addClass('active-toggle');
        }).on('mouseout', function() {
            $(this).parent().removeClass('active-toggle');
        })
    });
});
</script>

Article by

Mark Hendriksen

I am the founder here at MarkHendriksen.com a blog website for Web design, WordPress, and Divi. Learn more about Mark

20 thoughts on “How to Create a Custom Divi Header”

  1. Elegantly done, Mark!

    Thank you for sharing this. I look forward to implementing some of this in future client projects.

    Reply
  2. Great tutorial, one of my team has followed it found it so useful and easy to follow. Thanks.

    Is there a simple way to make the injected header disappear on scroll so just the fixed header stays?

    Reply
  3. Thank you Mark! Great tutorial! I did follow your tutorial, and I created as described but it doesn’t place the header above the Divi’s main header, it placed it on the top of the main header. Any Idea what I am doing wrong?

    Reply
    • Hi Diana,

      Did you placed the ID top-header in the section? It needs to be placed in the ID field not the CSS field

      Reply
      • Hi Mark,
        Thank you for your help, I do appreciate it.
        Yes, it is placed the ID filed. I can email you images before I place the code and after.

        Reply
  4. Is there a way to make the custom menu as my 3. menu?
    I already got a Main menu and a top menu, but im trying to make a third menu above the top menu? 🙂

    Reply
  5. Mark,

    Great tutorial, but for some odd reason I am having issues with this. When I put it in place there is a large gap at the top of the menu so it pushes the entire menu down to about double the size. I have adjusted it and it will not adjust

    Reply
    • To give a bit more information. When I inspect the page it appears that something is adding 154px padding to the top of the header and then fixing the position of the main header at 262px. I have looked at everything that I can think of and cannot find where this is being added.

      Reply
  6. Great tutorial, at last I have created a different header for a Divi website, freedom to design. Thank You!

    Reply

Leave a Comment

3 Shares
Share
Pin3
Tweet