I am trying to get my horizontal navigation bar to stick to the top of my screen. The problem is that if I set top to 0, the menu sticks to the top but the initial menu item gets overshadowed when you hover over it. When you take top out, the hover effect resumes to normal but the menu is no longer set to the top edge. What I have tried is messing with position as well as the hover options.
.nav ul {
list-style: block;
background-color: black;
padding: 0;
margin: 0;
position: absolute;
width: 100%;
top: 0;
text-align: center;
font-size: 110%;
}
.nav > ul > li {
text-align: center;
}
.nav li {
text-align: center;
}
.nav a {
text-decoration: none;
color: #fff;
display: block;
transition: .3s background-color;
}
.nav a:hover {
background-color: #005f5f;
}
.nav a.active {
background-color: #aaa;
color: #444;
cursor: default;
}
.nav li li {
font-size: .6em;
}
.nav li ul {
display: none;
position: absolute;
width: inherit;
}
.nav li:hover ul {
display: block;
}
.nav li ul li {
display: block;
}
}
.nav > ul > li > a {
padding-left: 0;
}