html - How do i change the color of my navbar that has a fixed position? -


i've been trying add "background-color" leaves big empty gap in between header img , header nav due position.without position, header nav wouldn't want (towards right)
(i can't use bootstrap or whatever because not in syllabus , im starting out code)

this code:

header {    margin-top: auto;    height: 79px;    overflow: hidden;  }    header img {    float: left;    position: fixed;    z-index: 2;    top: 0;  }    header nav {    float: right;    position: fixed;    z-index: 2;    top: 0;    height: 79px;    left: 542px;  }
<header>    <a href="index.html"><img src="images/greylogo.png" alt="e r i" /></a>    <nav>      <ul>        <li> <a href=#> home </a> </li>        <li> <a href="aboutme.html"> me </a> </li>        <li> <a href="events.html"> events </a></li>        <li> <a href="contact.html" target="_blank"> contact me </a></li>      </ul>    </nav>  </header>

position header not contents...

header {    height: 79px;    overflow: hidden;    position: fixed;    width: 100%;    background: lightblue  }    header img {    float: left;  }    header nav {    float: right;  }    header nav li {   float:left;     } 
<header>    <a href="index.html"><img src="images/greylogo.png" alt="e r i" /></a>    <nav>      <ul>        <li> <a href=#> home </a> </li>        <li> <a href="aboutme.html"> me </a> </li>        <li> <a href="events.html"> events </a></li>        <li> <a href="contact.html" target="_blank"> contact me </a></li>      </ul>    </nav>  </header>


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -