Answer the question
In order to leave comments, you need to log in
How to fix website menu error?
My code:
<header class="header">
<div class="header__inner">
<nav class="nav">
<a href="#" class="logo">
<img src="images/logo.png" alt="">
</a>
<div class="menu">
<ul class="menu__list">
<div class="menu__link__wrapper">
<a href="#" class="menu__link menu__link--active">Home</a>
<a href="#" class="menu__link">Destinations</a>
<a href="#" class="menu__link">About</a>
<a href="#" class="menu__link">Partner</a>
</div>
<div class="menu__btn">
<a href="#" class="btn">Login</a>
<a href="#" class="btn">Register</a>
</div>
</ul>
<div class="mobile-menu">
<a href="" class="menu-btn">
<span></span>
</a>
</div>
</div>
</nav>
</div>
</header>
.header{
width: 100%;
height: 100vh;
}
.header__inner{
display: flex;
width: 100%;
padding: 0 20px;
justify-content: center;
}
.nav{
width: 1290px;
padding-top: 45px;
height: 100px;
}
.nav, .menu, ul.menu__list{
display: flex;
justify-content: space-between;
align-items: center;
}
.menu__link__wrapper{
display: flex;
justify-content: space-between;
width: 350px;
margin-right: 35px;
}
a.menu__link{
color: #B8BECD;
font-size: 16px;
font-family: 'Inter-Regular', sans-serif;
transition: color .3s ease;
}
a.menu__link--active, a.menu__link:hover{
font-family: 'Inter-Medium', sans-serif;
font-weight: 500;
color: black;
}
.menu__btn a.btn:last-child{margin-right: 0;}
.menu__btn a.btn{margin-right: 20px;}
.menu__btn a.btn:first-child{
background-color: transparent;
border: 1.5px solid #FB8F1D;
color: #FB8F1D;
}
.menu__btn a.btn:first-child:hover{
background-color: #FB8F1D;
color: white;
transition: .5s ease;
}
.mobile-menu{
display: none;
}
.menu-btn{
display: block;
width: 40px;
height: 40px;
background-color: #FB8F1D;
border-radius: 8px;
position: relative;
}
.menu-btn span, .menu-btn span::before, .menu-btn span::after{
display: block;
width: 20px;
height: 2px;
background-color: #fff;
position: absolute;
top: 50%;
left: 50%;
margin-left: -10px;
margin-top: -1px;
transition: transform .3s ease-in;
}
.menu-btn span::before, .menu-btn span::after{
content: '';
}
.menu-btn span::before{
transform: translateY(-5px);
}
.menu-btn span::after{
transform: translateY(5px);
}
@media screen and (max-width: 1024px){
.mobile-menu{
display: block;
}
.menu-btn.menu-active span{
background-color: transparent;
}
.menu-btn.menu-active span::before, .menu-btn.menu-active span::after{
transform: translateY(0px);
}
.menu-btn.menu-active span::before{
transform: rotate(-45deg);
transition: transform .3s ease-in;
}
.menu-btn.menu-active span::after{
transform: rotate(45deg);
transition: transform .3s ease-in;
}
.menu__list{
visibility: hidden;
opacity: 0;
}
.menu__list.menu-active{
visibility: visible;
opacity: 1;
position: fixed;
width: 100%;
left: 0;
top: 0;
height: 100vh;
background-color: #222;
flex-direction: column;
}
.menu__list.menu-active, .menu__list.menu-active .menu__link__wrapper{
flex-direction: column;
align-items: center;
}
.menu__list.menu-active .menu__btn{
display: none;
}
.menu__list.menu-active .menu__link__wrapper{
position: absolute;
top: 50%;
transform: translateY(-50%);
align-content: space-between;
height: 70%;
}
.menu__list.menu-active .menu__link__wrapper a.menu__link{
color: white;
text-transform: uppercase;
}
}
a.btn{
padding: 17px 46px;
background-color: #FB8F1D;
border: 1.5px solid #FB8F1D;
border-radius: 8px;
color: #FFFFFF;
font-size: 15px;
font-family: 'Inter-Medium', sans-serif;
font-weight: 500;
transition: .45s ease;
}
$('.mobile-menu').on('click', function(e){
e.preventDefault();
$('.menu-btn').toggleClass('menu-active')
$('.menu__list').toggleClass('menu-active')
})
Answer the question
In order to leave comments, you need to log in
.header__inner{
display: flex;
width: 100%;
padding: 0 20px;
justify-content: center;
}
.nav{
width: 1290px;
padding-top: 45px;
height: 100px;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question