How to Automatically Place Your Header Below Each Page’s First Divi Section

Posted on January 7, 2020 by in Divi Resources | 9 comments

How to Automatically Place Your Header Below Each Page’s First Divi Section

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.

Preview

Before we dive into the tutorial, let’s take a quick look at the outcome across different screen sizes.

Desktop

first Divi section

Mobile

first Divi section

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.

first Divi section

Use On

Use this new template on all pages.

  • Use On: All Pages

first Divi section

2. Start Building Custom Header Design

Continue by building a custom header inside the page template.

first Divi section

Section Settings

Background Color

Once inside the template editor, you’ll notice a section. Open that section and change the background color.

  • Background Color: #FFFFFF

first Divi section

Spacing

Remove the section’s default top and bottom padding next.

  • Top Padding: 0px
  • Bottom Padding: 0px

first Divi section

Border

Add a top and bottom border too.

  • Top & Bottom Border Width: 1px
  • Top & Bottom Border Color: #002d4c

first Divi section

CSS ID

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

first Divi section

Z Index

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

first Divi section

Add New Row

Column Structure

Continue by adding a new row to the section using the following column structure:

first Divi section

Sizing

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%

first Divi section

Spacing

Remove all default top and bottom padding as well.

  • Top Padding: 0px
  • Bottom Padding: 0px

first Divi section

Main Element

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;

first Divi section

Column 1

Spacing

Continue by opening the column 1 settings and add some top and bottom padding to the spacing settings.

  • Top Padding: 20px
  • Bottom Padding: 20px

first Divi section

Border

Add a right border to the column as well.

  • Right Border Width: 1px
  • Right Border Color: #002d4c

first Divi section

Add Image Module to Column 1

Upload Logo

Time to start adding modules! In column 1, we’ll need an Image Module. Upload your logo.

first Divi section

Alignment

Move on to the module’s design tab and change the image alignment.

  • Image Alignment: Center

first Divi section

Sizing

Modify the module’s width across different screen sizes too.

  • Width: 4vw (Desktop), 7vw (Tablet), 12vw (Phone)

first Divi section

Add Menu Module to Column 2

Select Menu

On to the second column, there, we’ll need a Menu Module. Select a menu of your choice.

first Divi section

Layout

Move on to the module’s design tab and change the layout settings as follows:

  • Style: Centered
  • Dropdown Menu Direction: Downwards

first Divi section

Menu Text

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

first Divi section

Dropdown Text

Then, change some colors in the dropdown text settings.

  • Dropdown Menu Background Color: #ffffff
  • Dropdown Menu Line Color: #002d4c

first Divi section

Icons

And complete the module’s settings by changing the hamburger menu icon color in the icons settings.

  • Hamburger Menu Icon Color: #002d4c

first Divi section

Add Button Module to Column 3

Add Copy

On to the next and last column. There, we’ll need a Button Module. Add some copy of your choice.

first Divi section

Alignment

Move on to the module’s design tab and change the button alignment.

  • Button Alignment: Center

first Divi section

Button Settings

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

first Divi section

  • Button Letter Spacing: 2px
  • Button Font: Cabin
  • Button Font Weight: Semi Bold
  • Button Font Style: Uppercase

first Divi section

Spacing

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)

first Divi section

Box Shadow

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

first Divi section

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.

first Divi section

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:

jQuery(function($){
$(‘#custom-header’).insertAfter(‘.et_pb_section_0’);
});

first Divi section

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!

first Divi section

first Divi section

Preview

Now that we’ve gone through all the steps, let’s take a final look at the outcome across different screen sizes.

Desktop

first Divi section

Mobile

first Divi section

Final Thoughts

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.

Premade Layouts

Check Out These Related Posts

9 Comments

  1. Very good! All it needs now is for the logo and nav to go sticky once scrolling kicks in. I think that possibility will happen with a future Divi update?

    Suggestion. While it is always good for us to tweak these designs a bit further to fit our own designs. I think these tutorials would benefit the end user with a bit more finesse. For example, on tablet/mobile the menu when open occupies a narrow drop down column. It looks far better if the menu opens from the bottom of the menu and if it is full width. Something like the following styling was added in another header tutorial and it just adds that bit more value to the offering:

    .mobile_menu_bar { padding: 30px 0; }

    .et_mobile_menu {
    width: 350% !important;
    margin-left: -120% !important;
    }

  2. Thank you, it’s a very good idea, i love it!

  3. Great stuff as usual Donjete.

  4. Nice post thanks for sharing

  5. Is there a way to place it in the footer too?

  6. Thanks for this. I was earlier adding all the headers manually for my blog. Do you think making the header dynamic will speed up the page loading compared with adding header manually for each section?

  7. jQuery(function($){
    $(‘#custom-header’).insertAfter(‘.et_pb_section_0’);
    });

    This function does not appear to be placing the first section above my header?

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Join To Download Today

Pin It on Pinterest