this is my html and css:
body {
  background-color: green;
}
.navbar {
  overflow: hidden;
  background-color: #333;
  text-align: center;
  width: 100%;
}
.navbar a {
  float: left;
  font-size: 18px;
  color: white;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
}
.dropdown {
  float: left;
  overflow: hidden;
}
.dropdown .dropbtn {
  font-size: 18px;  
  border: none;
  outline: none;
  color: white;
  padding: 14px 16px;
  background-color: inherit;
  font-family: inherit;
  margin: 0;
}
.navefix:hover, .dropdown:hover, .dropbtn {
  background-color: red;
  cursor: pointer;
}
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1;
}
.dropdown-content a {
  float: none;
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}
.dropdown-content a:hover {
  background-color: #ddd;
}
.dropdown:hover .dropdown-content {
  display: block;
}
<body>
  <div class="navbar">
      <a></a>
      <div class="dropdown">
        <button class="dropbtn" onclick="location.href='index.html'">Index 
        </button>
        <div class="dropdown-content">
          <a href="page1.html">page1</a>
          <a href="page2.html">page2</a>
          <a href="page3.html">page3</a>
        </div>
      </div> 
      <a href="page4.html" class="navefix">page4</a>
    </div>
</body>
See you can see it in the code snipped, the navbar should stretch outside the window so there is no green space between the navbar and the page sides.