Add Lines Between Divi Menu Items
A lot of our Divi Menu tutorials have been functional, while fewer of them have been about style and design. This tutorial will add some style to your Divi menu! I will show you how to add vertical divider lines between the menu items.
Add Vertical Dividers To The Divi Menu Module
The first snippet here will apply to the Divi Menu module, so you probably will want to be using this in a header template in the amazing Theme Builder.
Using More Than One Menu Module
You don’t need to add any class to the module since we are targeting it, but if you want this effect to only apply to one menu module on your site, then replace the .et_pb_menu with your own CSS class and add that to the module’s CSS field in the advanced tab.
Copy the code snippet below and paste it in the Divi>Theme Options>Custom CSS box. If you want to learn more about adding code to Divi, be sure to check out our full guide on Where To Add Custom Code In Divi.
/*add borders to the menu items*/
.et_pb_menu nav > ul > li:not(:last-child) {
border-right: 1px solid #2cba6c;
}
/*adjust spacing around menu items*/
.et_pb_menu li a {
padding: 4px 20px;
}
Add Vertical Dividers To The Default Divi Menu
Even though I totally recommend using the new Divi Theme Builder and Menu module, I haven’t forgotten those of you who are still using the default header. The snippet is very similar to the one above, except the CSS property is targeting the default menu instead of the Menu module. The step here is exactly the same. Copy the code snippet below and paste it in the Divi>Theme Options>Custom CSS box.
/*add borders to the menu items*/
#top-menu li:not(:last-child) {
border-right: 1px solid #2cba6c;
margin-bottom: 20px;
}
/*adjust spacing around menu items*/
#et-top-navigation nav > ul > li > a {
padding-bottom: 4px!important;
padding-left: 20px;
}
Now you have vertical divider lines in your Divi menu!
Customize The Snippets
You may need to play around with the spacing in the snippets to fit your website. For example, you may need to change the margin and padding values to something that works better for your situation. Other than that, you should be good to go!
Be sure to check out our 20 other Divi menu tutorials!
Simple and Cool!
Thank u! 🙂
You’re welcome!
Works great–Thank you!!
Perfect, glad you found this useful! 🙂
Hi, thanks for this tutorial. What about small vertical dividers in case logo inserted in menu module? Dividers are so height as logo…do you have any idea?
Hi Sebastian,
If you share the link I can take a look!
https://server777937.nazwa.pl/nowe_www/banimex/
any idea?
Looks like you got it with the padding, I was going to say it but you beat me to it!
I am also interested
Hi John, you have to adjust the padding or assign a height. It’s impossible for me to put that in the code since every site is different. Send me the link and I’ll advise.
Thank you so much! It looks great except on the drop down menu items. Do you know how to exclude the sub-menu items for drop down menus?
Hi Cynthia, great question, I updated the code so that it does that by default now, like .et_pb_menu nav > ul > li:not(:last-child)