How to Create a Sticky Header with Divi’s Sticky Options

Last Updated on September 22, 2022 by 9 Comments

How to Create a Sticky Header with Divi’s Sticky Options
Blog / Divi Resources / How to Create a Sticky Header with Divi’s Sticky Options

The way we use the Divi and its Theme Builder when setting up a website has sped up our workflow and made everything easier. Although we were able to create customized headers from day one ever since the Divi Theme Builder came out, one thing has been requested continuously, which is being able to create a sticky header without using additional code. With Diviโ€™s new sticky options, creating a sticky header has become easier than ever. The sticky settings Divi provides will effortlessly help you turn any design element sticky and assign custom styles to a sticky state, which results in endless design and user experience possibilities.

In this tutorial, weโ€™ll show you how to create a sticky header that contains the following:

  • The header weโ€™re creating has a top header bar + a menu bar
  • Weโ€™re turning the section containing the menu bar sticky when you pass by it, as soon as you go back to the top, the header bar appears again
  • Weโ€™re changing the sticky sectionโ€™s (and its elements) design styles once the section is turned sticky

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

sticky header

Mobile

sticky header

Download The Global Header Template for FREE

To lay your hands on the free global 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 newsletter 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. Building The Header Element Structure Inside a New Header Template

Create New Global Header Template

Go to the Divi Theme Builder and start building a new global or custom header.

sticky header

sticky header

Section #1 Settings

Gradient Background

Once inside the template editor, weโ€™ll start by building the element structure of our header. In part two of this tutorial, weโ€™ll focus on applying the different sticky settings to complete our sticky header design. Inside the template editor, youโ€™ll notice a section. Open that section and apply a gradient background.

  • Color 1: #ffba60
  • Color 2: #ffd6a0
  • Gradient Direction: 90deg
  • Start Position: 50%
  • End Position: 50%

sticky header

Spacing

Remove all default top and bottom padding next.

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

sticky header

Add New Row

Column Structure

To create our top header bar, weโ€™ll add a new row to our section using the following column structure:

sticky header

Sizing

Without adding any modules yet, open the row settings and modify the sizing settings as follows:

  • Use Custom Gutter Width: Yes
  • Gutter Width: 1
  • Width: 95%
  • Max Width: 2580px

sticky header

Spacing

Add some custom top and bottom padding too.

  • Top Padding: 15px
  • Bottom Padding: 15px

sticky header

Main Element CSS

And to make sure the columns remain next to each other on smaller screen sizes, weโ€™ll add one line of CSS code to the rowโ€™s main element in the advanced tab.

display: flex;

sticky header

Add Social Media Follow Module to Column 1

Add Social Networks of Choice

Time to add modules, starting with a Social Media Follow Module in column 1. Add the social networks of your choice along with their corresponding links.

sticky header

Remove Each Social Networkโ€™s Background Color

Continue by removing each one of the social networkโ€™s background colors individually.

sticky header

sticky header

Icon Settings

Then, go back to the general module settings and change the icon color in the design tab.

  • Icon Color: #26333a

sticky header

Spacing

Add some top margin too.

  • Top Margin: 5px

sticky header

Add Button Module to Column 2

Add Copy

In column 2, the only module we need is a Button Module. Add some copy of your choice.

sticky header

Add Link

Add a link next.

sticky header

Button Alignment

Then, move on to the design tab and change the button alignment.

  • Button Alignment: Right

sticky header

Button Settings

Weโ€™re styling the button too.

  • Use Custom Styles For Button: Yes
  • Button Text Size: 14px
  • Button Text Color: #26333a
  • Button Border Width: 2px
  • Button Border Color: #26333a
  • Button Border Radius: 0px

sticky header

  • Button Letter Spacing: 4px
  • Button Font Weight: Bold
  • Button Font Style: Uppercase
  • Show Button: Yes

sticky header

Spacing

And weโ€™ll complete the module settings by adding some top and bottom padding to the spacing settings.

  • Top Padding: 10px
  • Bottom Padding: 10px

sticky header

Add Section #2

Gradient Background

Add another regular section right below the previous one. This section will be dedicated to our menu and will be turned sticky in the second part of this tutorial. Once youโ€™ve added the section, apply a gradient background.

  • Color 1: #ffffff
  • Color 2: #f7f7f7
  • Gradient Type: Linear
  • Gradient Direction: 90deg
  • Start Position: 25%
  • End Position: 25%

sticky header

Spacing

Move on to the sectionโ€™s design tab and remove all default top and bottom padding.

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

sticky header

Add New Row

Column Structure

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

sticky header

Sizing

Move on to the rowโ€™s design tab and change the sizing settings as follows:

  • Use Custom Gutter Width: Yes
  • Gutter Width: 1
  • Max Width: 2580px

sticky header

Spacing

Remove all default top and bottom padding next.

  • Top Padding: 10px
  • Bottom Padding: 10px

sticky header

Add Menu Module to Column

Select Menu

Then, add a Menu Module to the rowโ€™s column and select a dynamic menu of your choice.

sticky header

Upload Logo

Upload a logo next.

sticky header

Remove Background Color

Then, remove the moduleโ€™s default white background color.

sticky header

Menu Text Settings

Move on to the design tab and style the menu text settings too.

  • Menu Font Weight: Bold
  • Menu Text Color: #002d4c
  • Menu Text Size: 15px
  • Menu Letter Spacing: 4px
  • Text Alignment: Right

sticky header

Dropdown Menu Text Settings

Then, make some changes to the dropdown menu settings.

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

sticky header

Icons Settings

Along with the icons settings.

  • Shopping Cart Icon Color: #002d4c
  • Search Icon Color: #002d4c
  • Hamburger Menu Icon Color: #002d4c

sticky header

Sizing

And complete the module settings by adding a logo max height to the sizing settings.

  • Logo Max Height: 60px

sticky header

2. Apply Custom Sticky Effects

Turn Section #2 Sticky

Now that we have created the element structure of our header, itโ€™s time to turn our second section sticky and change the design style of it and its elements in a sticky state. Open the second sectionโ€™s settings and move on to the advanced tab. There, go to the scroll effects settings and apply the following sticky options:

  • Sticky Position: Stick to Top
  • Sticky Top Offset: 0px
  • Bottom Sticky Limit: None
  • Offset From Surrounding Sticky Elements: Yes
  • Transition Default and Sticky Styles: Yes

sticky header

Change Sectionโ€™s Gradient Background in Sticky State

Now that our section has been turned sticky, an additional option will appear inside our section, row and module settings; the sticky option. When you click this icon, youโ€™ll be able to create an alternative style for the element youโ€™ve selected while in a sticky state. Weโ€™re going to combine a couple of these sticky design settings to customize the look and feel of our sticky header on scroll. Start by going to the second sectionโ€™s background settings and apply the following sticky gradient background:

  • Color 1: #26333a
  • Color 2: #1e272f

sticky header

Stretch Row in Sticky State

Next, weโ€™ll open the row containing the Menu Module and weโ€™ll modify the width in a sticky state.

  • Width: 95%

sticky header

Remove Row Padding in Sticky State

Weโ€™re removing the sticky top and bottom padding of our row too.

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

sticky header

Change Menu Text Color in Sticky State

Next, weโ€™ll change the menu text color in a sticky state.

  • Menu Text Color: #ffbd68

sticky header

Change Menu Icon Colors in Sticky State

Along with the icon colors.

  • Shopping Cart Icon Color: #ffffff
  • Search Icon Color: #ffffff
  • Hamburger Menu Icon Color: #ffffff

sticky header

Remove Logo Height in Sticky State

And last but not least, weโ€™ll change the logo max height to zero in a sticky state. This will remove the logo from our header entirely once the sectionโ€™s sticky settings are enabled. Thatโ€™s it! Make sure you save all Divi Theme Builder changes once youโ€™ve completed your header design and preview it on your website.

  • Logo Max Height: 0px

sticky header

Preview

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

Desktop

sticky header

Mobile

sticky header

Final Thoughts

In this post, weโ€™ve shown you how to create a sticky header using Diviโ€™s Theme Builder and sticky options. As soon as the section containing our menu is turned sticky, weโ€™re applying custom styles as well. These options are made possible by the new Divi sticky options that provide you with countless possibilities to improve the user experience and design you create. You were able to download the global header 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.

Divi Marketplace

Are You A Divi User? Find Out How To Get More From Divi! ๐Ÿ‘‡

Browse hundreds of modules and thousands of layouts.

Visit Marketplace
Divi Marketplace
Divi Cloud

Find Out How To Improve Your Divi Workflow ๐Ÿ‘‡

Learn about the new way to manage your Divi assets.

Get Divi Cloud
Divi Cloud
Divi Hosting

Want To Speed Up Your Divi Website? Find Out How ๐Ÿ‘‡

Get fast WordPress hosting optimized for Divi.

Speed Up Divi
Divi Hosting
Premade Layouts

Check Out These Related Posts

9 Comments

  1. How do you get the sticky state options on the row and the menu module?
    We only made the section sticky, only the section has sticky state options

  2. the gradient is not changing in sticky header

    • Same identical problem. Did you find a solution?

    • Hi there, I recommend that you reach out to the Support Team directly so they can check that out for you. Just open a chat using the pink circle button floating at the bottom.

  3. Loving the Divi Experience and these tutorials helping to get the most out of Divi ๐Ÿ™‚

  4. It’s really awesome to learn about some more cool customization with the DIVI.

    The panel to customize with just some click is really awesome and I really love them.

    First, I thought it wouldn’t look good on mobile, but after I tried I found out that it’s better for mobile as well.

    Thanks for sharing such a great article.

  5. The new sticky feature works well in most cases and would be 100% spot on if you could use it effectively on a simple set header that doesn’t move or change style. Ideally with sticky the header will set the page content correctly so it isn’t tucked under the header. This is good. The drawback is that while it is perfect when viewing in Firefox, in Chrome the header will judder slightly when you start to scroll and in Safari it jumps quite noticeably. So it isn’t really useable.

    I have contacted support and they have acknowledged this issue. I really do hope that it gets fixed.

    In the meantime you have to revert tho a fixed position for these basic headers and pad/margin your content for a few different viewports.

    Then again the more complex headers, such as the one in the tutorial are probably fine and most welcome.

  6. I’ve been using the Divi for the last 1 week in one of my websites and it is really awesome. Thanks to the developers. One small issue that I face is the adjustment of the logo. While using the sticky state, it is difficult for me adjust the logo height. When I scroll the page, the logo disappear. I tried a few tutorials but still stuck at the same place. Your answer might be a great help. Thanks

  7. Hello,
    thank you very much for this really interesting tutorial!
    I have already implemented it on a site with some modifications,
    but the effect is really great and even more so on mobile!
    The “Sticky” options are truly amazing!
    Thank you

Leave A Reply

Comments are reviewed and must adhere to our comments policy.

Join To Download Today