Ever since the Divi Theme Builder has come out, we’ve been sharing tutorials on how to create and customize a header to match it with different needs you might have. In today’s tutorial, we’ll continue that journey by showing you how to automatically place a custom header below each page’s first Divi section. This approach allows visitors to see the hero section of your pages first and then get access to the menu and all its items. The style we’re using for the custom header matches the Bistro Layout Pack, you’ll be able to download the custom page template for free as well!
Let’s get to it.
Before we dive into the tutorial, let’s take a quick look at the outcome across different screen sizes.
Download The Custom Header Template for FREE
To lay your hands on the free custom header template, you will first need to download it using the button below. To gain access to the download you will need to subscribe to our Divi Daily email list by using the form below. As a new subscriber, you will receive even more Divi goodness and a free Divi Layout pack every Monday! If you’re already on the list, simply enter your email address below and click download. You will not be “resubscribed” or receive extra emails.
1. Go to Divi Theme Builder & Add New Page Template
Go to Divi Theme Builder & Add New Template
Start by going to the Divi Theme Builder and add a new template.
Use this new template on all pages.
- Use On: All Pages
2. Start Building Custom Header Design
Continue by building a custom header inside the page template.
Once inside the template editor, you’ll notice a section. Open that section and change the background color.
- Background Color: #FFFFFF
Remove the section’s default top and bottom padding next.
- Top Padding: 0px
- Bottom Padding: 0px
Add a top and bottom border too.
- Top & Bottom Border Width: 1px
- Top & Bottom Border Color: #002d4c
And include a CSS ID. Later on the tutorial, we’ll use this CSS ID to place the section below each page’s first section.
- CSS ID: custom-header
Last but not least, we’ll increase the section’s z index to make sure it appears on top of all page content.
- Z Index: 99999
Add New Row
Continue by adding a new row to the section using the following column structure:
Without adding any modules yet, open the row settings and allow the row to take up the entire section’s width.
- Use Custom Gutter Width: Yes
- Gutter Width: 1
- Width: 100%
- Max Width: 100%
Remove all default top and bottom padding as well.
- Top Padding: 0px
- Bottom Padding: 0px
To make sure all columns remain next to each other on smaller screen sizes, and to center the column content, we’ll also add two lines of CSS code to the row’s main element.
display: flex; align-items: center;
Continue by opening the column 1 settings and add some top and bottom padding to the spacing settings.
- Top Padding: 20px
- Bottom Padding: 20px
Add a right border to the column as well.
- Right Border Width: 1px
- Right Border Color: #002d4c
Add Image Module to Column 1
Time to start adding modules! In column 1, we’ll need an Image Module. Upload your logo.
Move on to the module’s design tab and change the image alignment.
- Image Alignment: Center
Modify the module’s width across different screen sizes too.
- Width: 4vw (Desktop), 7vw (Tablet), 12vw (Phone)
Add Menu Module to Column 2
On to the second column, there, we’ll need a Menu Module. Select a menu of your choice.
Move on to the module’s design tab and change the layout settings as follows:
- Style: Centered
- Dropdown Menu Direction: Downwards
Modify the menu text settings too.
- Menu Font: Cabin
- Menu Text Color: #77848d
- Menu Text Size: 16px (Desktop), 15px (Tablet), 14px (Phone)
- Menu Line Height: 1.8em
Then, change some colors in the dropdown text settings.
- Dropdown Menu Background Color: #ffffff
- Dropdown Menu Line Color: #002d4c
And complete the module’s settings by changing the hamburger menu icon color in the icons settings.
- Hamburger Menu Icon Color: #002d4c
Add Button Module to Column 3
On to the next and last column. There, we’ll need a Button Module. Add some copy of your choice.
Move on to the module’s design tab and change the button alignment.
- Button Alignment: Center
Continue by styling the button in the button settings.
- Use Custom Styles For Button: Yes
- Button Text Size: 13px
- Button Text Color: #002d4c
- Button Background Color: #ffffff
- Button Border Width: 2px
- Button Border Color: #ffffff (Default), #d1d1d1 (Hover)
- Button Border Radius: 0px
- Button Letter Spacing: 2px
- Button Font: Cabin
- Button Font Weight: Semi Bold
- Button Font Style: Uppercase
Then, add some custom padding across different screen sizes.
- Top Padding: 16px
- Bottom Padding: 16px
- Left Padding: 24px (Desktop & Tablet), 13px (Phone)
- Right Padding: 24px (Desktop & Tablet), 13px (Phone)
Complete the module’s settings by adding a box shadow.
- Box Shadow Horizontal Position: 0px
- Box Shadow Vertical Position: 0px
- Box Shadow Blur Strength: 0px
- Box Shadow Spread Strength: 2px (Default), 6px (Hover)
- Shadow Color: #002d4c
- Box Shadow Position: Inner Shadow
3. Automatically Place Header After Each Page’s First Section Using JQuery
Add Code Module to Column 2
Now, to automatically place the menu below each page’s first section, we’ll need a bit of JQuery code. To include this code in our custom header, add a Code Module to column 2.
Insert JQuery Code
Add the following lines of JQuery code, between script tags as you can notice in the print screen below, to the Code Module to apply the effect:
4. Save Theme Builder Changes & View Result
And complete the custom header by saving all theme builder changes and viewing the outcome on your pages!
Now that we’ve gone through all the steps, let’s take a final look at the outcome across different screen sizes.
In this post, we’ve shown you how to automatically place the custom header you build using Divi’s Theme Builder after each page’s first Divi section. You’ll only need to build the custom header once, add the JQuery code and the custom header will automatically be repositioned. This is a great way to change up the menu’s normal top-page position and allow your hero section to shine first. You were able to download the template for free as well! If you have any questions or suggestions, feel free to leave a comment in the comment section below!
If you’re eager to learn more about Divi and get more Divi freebies, make sure you subscribe to our email newsletter and YouTube channel so you’ll always be one of the first people to know and get benefits from this free content.