Links Not Working In Fixed Header CSS
Hi, I'm a super beginner and I coded my own website, which has been up for a while now. I am now trying to create a sticky (fixed) header so that it stays on top while people scroll. However, whenever I include position:fixed in my .header CSS the links on my header stop working.
This is my CSS:
.header {
background-color:#B6DCE3;
width:100%;
height:70px;
align-content:center;
position:fixed;
}
ul {
text-align:center;
align-content:center;
margin:0px;
padding:0px;
font-family:"Open Sans", "Roboto", "Helvetica Neue";
font-size:20px;
font-weight:300;
}
li {
display:inline;
color:#0020B7;
text-align:center;
}
li a:hover {
color:#FFFFF;
}And here is my HTML:
<div class="header">
<br>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>For some reason when I remove position:fixed; from the CSS the links will work. But when I put it in, the links are gone and it doesn't follow the hover command either.
If someone knows what I am doing wrong, I'd greatly appreciate help please. Thanks!
