Module 7 - Lesson 3

Website Header

In this video, we’ll create the website header inside the Theme Builder. Using custom CSS, we’ll add an animated hover effect to menu items, edit the dropdown sub-menu and the mobile menu version.

Video Chapters

00:00 Introduction

00:40 Creating WordPress Menu

01:36 Global Theme Builder Header

05:50 Default Button line-height

06:37 Header Section settings

10:26 Modules Alignment

12:02 Blur the background behind the header

12:56 Styling Menu items

16:07 Styling Sub-menu

23:21 Menu items hover effect

32:25 Mobile Column Structure

36:57 Styling Mobile Menu

style.css

/*
______________________
   
   Header
______________________

*/
   
/* Column alignment */   
#maya-header .et_pb_row {
    align-items: baseline;
}
#maya-header .et_pb_row .et_pb_column:first-child {
    align-self: flex-end;
}

/* Hide CTA for small phones */
@media (max-width:430px) {
    #maya-header .et_pb_column:nth-child(3) {
        display:none;
    }
}

/* Sticky Section background */
#maya-header {
    backdrop-filter: blur(7px)
}

/* Main Menu Module */
#maya-header .et_pb_menu .et-menu>li {
    padding:10px 20px;
}

#maya-header .et_pb_menu .et-menu>li a:hover {
    opacity:1;
}

/* Top Level Menu Hover Effect */
#maya-header .et_pb_menu .et-menu > li a {
    position:relative;
}

#maya-header .et_pb_menu .et-menu > li > a:before {
    content:'';
    display:block;
    position:absolute;
    bottom:-20px;
	left:0;
	right:0;
	height:10px;
	background:url(img/zigzag.svg) repeat-x;
	animation: zigzagPlay 3s infinite linear;
	opacity:0;
	transition:all .3s ease-in-out;
} 

@keyframes zigzagPlay {
	0% {
		background-position: 0;
	}
	100% {
		background-position:-70px;
	}
}

#maya-header .et_pb_menu .et-menu > li > a:hover:before {
	opacity:1;
	bottom:-10px;
}

/* Submenu */
#maya-header .sub-menu {
    border:none;
    border-radius:2px;
    padding:20px;
    width:200px;
    transition:all .3s ease-in-out;
    top:calc(100% + 9px);
}

#maya-header .sub-menu li {
    width:100%;
    padding:0;
}

#maya-header .sub-menu li a {
    padding:0 0 10px;
    font-family:"Barlow", sans-serif;
    font-wieght:700;
    font-size:16px;
    text-transform:none;
    letter-spacing:0;
    background:none;
    transition:all .3s ease-in-out;
}

#maya-header .sub-menu li:last-child a {
    padding:0;
}

#maya-header .sub-menu li a:hover {
    padding-left:5px;
}

#maya-header .nav li:hover > ul, #maya-header .nav li.et-touch-hover > ul {
    top:calc(100% - 1px)
}  
  

/* Mobile Header Structure & Menu */
@media (max-width:980px) {

    #maya-header .et_pb_row {
        display: flex;
        align-items:center;
    }
    #maya-header .et_pb_column {
        margin-bottom:0;
    }
    #maya-header .et_pb_column:nth-child(1) {
        order:1;
    }
    #maya-header .et_pb_column:nth-child(2) {
        order:3;
    }
    #maya-header .et_pb_column:nth-child(3) {
        order:2;
    }

    #maya-header .et_pb_menu__wrap {
        justify-content:flex-end;
    }
    
    /* Mobile Menu */

    #maya-header .mobile_menu_bar:before {
        font-size: 40px;
    }

    #maya-header .opened .mobile_menu_bar:before {
        content:'\4d';
    }

    #maya-header .et_mobile_menu {
        position: fixed;
        display: block!important;
        margin: 0!important;
        height: 100%!important;
        min-height: 100vh;
        padding: 100px 0 0!important;
        max-width: 300px;
        left: auto;
        right: -300px;
        top: 0;
        z-index: 39;
        transition: all 1s ease-in-out;
    }

    #maya-header .opened .et_mobile_menu {
        right: 0;
    }

    #maya-header .mobile_menu_bar {
        z-index: 40;
    }
	
	/* Position "Fixed" inside the Sticky Section fix */
    #maya-header.et_pb_sticky * {
        transform:none!important;
    }
	
	/* Mobile Sub-menu */
    #maya-header .sub-menu {
        width:auto;
        padding:0;
    }
    #maya-header .sub-menu li a,
    #maya-header .sub-menu li a:hover,
    #maya-header .sub-menu li:last-child a {
        padding:10px 25px 10px 35px;
    }

}

Join the discussion

Share your thoughts about this lesson with fellow students!

Login to your Account

If you're a DSA Student, please log in to your account to access the course content.

Sorry, you don't have access to this content.

It looks like you're not enrolled in Divi Stylist Academy.