We create a number of custom menu hover effects for many of our clients and child themes so I decided it is time to get some of those tutorials into your hands.
In this tutorial I am going to show you how you can make a Divi Menu Top and Left Border that slides down to the bottom of the menu item.
*Note: This customization will not work correctly if you have drop down sub-menus. That will require additional modifications not yet available on this tutorial.
Let’s Get Started Making The Divi Menu Slide Down Border
Adding The Custom CSS
If you are working with a child theme you can go to Appearance>Editor and open your stylesheet. If not, go to Appearance>Divi Theme Options>Custom CSS (which is located at the bottom of the first tab in Theme Options)
Add this CSS.
/*------------------------------------------------*/ /*-----------[GQ - SLIDE DOWN BORDERS]------------*/ /*------------------------------------------------*/ #et-top-navigation nav > ul > li > a { padding-bottom: 12px!important; margin-bottom: 12px;} #top-menu-nav > ul > li > a { display: inline-block; position: relative; padding: 10px 7px;} #top-menu-nav > ul > li > a::before { position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: #3173b5; content: ''; -webkit-transition: top 0.3s; -moz-transition: top 0.3s; transition: top 0.3s;} #top-menu-nav > ul > li > a::after { position: absolute; top: 0; left: 0; width: 2px; height: 2px; background: #3173b5; content: ''; -webkit-transition: height 0.3s; -moz-transition: height 0.3s; transition: height 0.3s;} #top-menu-nav > ul > li > a:hover::before { top: 100%; opacity: 1;} #top-menu-nav > ul > li > a:hover::after { height: 100%;}
Making Adjustments
Now because there are already so many menu padding options available in the Theme Customizer, there is a good chance you may have to adjust the bottom padding of the main buttons. You can change that here.
The following rules change the top border and the left border
The following rules change the thickness and the location of the borders.
The following rules change the timing of the slide down.
And lastly, the following rule changes the border colors.
And that’s it.
If you used this on one of your projects, please share a link below so we can see how you used it.
Have fun!
Well, that’s all for now. I hope you find this article useful.