- Setting up your menu and assigning the correct classes to your menu items
- Building your menu using the Theme Builder and Menu Module
- Adding the custom code inside the Theme Builder
Preview
Before we dive into the tutorial, let’s take a quick look at the outcome across different screen sizes.Desktop
1. Set up Your Menu
Add Menu Items & Sub Menu Items
The first thing you need to do is create your menu. Add the sub-items of your choice.
Add CSS Class Option
Once you’ve added the menu items, you can enable the CSS classes option by clicking on ‘Screen Options’ and enabling ‘CSS Classes’.Add CSS Class to First-Level Menu Items Containing Sub Menu Items
Continue by adding a CSS class to the first-level menu items that contain sub-menu items. In this example, that means adding the CSS class to the ‘Service’ and ‘Portfolio’ menu items.CSS Classes: first-level
Add CSS Class to Second-Level Menu Items & Save Menu
Then, assign a different CSS class to the second-level menu items in your menu. Make sure you add this CSS class to the second-level menu items only (in case you’re adding more levels). Later on this tutorial, we’ll use this CSS class and the one we’ve assigned to the first level menu items to create the collapsing nested menu.CSS Classes: second-level
2. Go to Divi Theme Builder & Start Building Global Header
Go to Divi Theme Builder
The next part of this tutorial focuses on creating the header design. If you want to make the nested technique apply to a header that you’ve already built (using the Menu Module), you can skip this step and go to the tutorial’s last part. If you want to recreate the design, keep following the steps. Go to the Divi Theme Builder.Start Building Global Header
Start building your global header next.Section Settings
Spacing
Inside the template editor, you’ll notice a section. Open that section and remove all default top and bottom padding.Top Padding: 0px
Bottom Padding: 0px
0 Comments