I recently created a website using a template from w3school. I have a question regarding the anchor elements in my navigation bar:
Why do the anchor elements (home, band, tour, contact) jump when clicked? Does anyone know how to fix this issue?
I've tried searching online for solutions but haven't found anything helpful. Can someone please assist me with this?
And here is the template I used for my website
Thank you in advance for any help provided!
/*reset CSS*/
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
html{
font-family: Arial, Helvetica, sans-serif;
}
.header{
height: 46.4px;
background-color: black;
}
.header>.nav>.nav__item>a{
display: block;
color: white;
text-decoration: none;
line-height: 46.4px;
padding: 0px 24px;
}
.header>.nav>.nav__item{
display: inline-block;/*to set in the same line*/
}
.header>.nav .sub_nav{
list-style-type: none;
}
.header>.nav .sub_nav{
/* display: none; */
}
.header>.nav .sub_nav a{
text-decoration: none;
color: white;
}
.header>.nav li:hover>a{
color: black !important;
background-color: #ccc;
}
.slider{
background-color: #333;
width: 100%;
height: 500px;
}
<div class="main">
<div class="header">
<ul class="nav">
<li class="nav__item"><a href="">Home</a></li>
<li class="nav__item"><a href="">Band</a></li>
<li class="nav__item"><a href="">Tour</a></li>
<li class="nav__item"><a href="">Contact</a></li>
<li class="nav__item">
<a href="">More</a>
<ul class="sub_nav">
<li><a href="">Merchandise</a></li>
<li><a href="">Extras</a></li>
<li><a href="">Media</a></li>
</ul>
</li>
</ul>
</div>
<div class="slider">
</div>
<div class="content">
</div>
<div class="footer">
</div>
</div>