Ad

How To Add Navigation Bar On A Image

First day of me learning to code in html and css. I'm trying to add navigation bar on a image but i am unable to do so. The background image i am trying to add is not displaying too. Can anyone help me out here.

.header {
  background-image: url("vent1.jpg");
}

.nav {
  overflow: hidden;
  float: left;
  background-color: #333;
  margin: 0px;
  padding: 0px;
  list-style-type: none;
}

.menu-bar {
  list-style-type: none;
  text-align: center;
}

.ul {
  display: inline-block;
  padding: 8px;
  margin: 0px;
  color: white;
}
<div class="header">
  <div class="nav">
    <div class="menu-bar">
      <ul>
        <li><a target="_blank" rel="nofollow noreferrer" href="#contact"> Home</a></li>
        <li>
          <a target="_blank" rel="nofollow noreferrer" href="#aboutus"></a>About Us</li>
        <li>
          <a target="_blank" rel="nofollow noreferrer" href="#portfolio"></a>Portfolio</li>
        <li>
          <a target="_blank" rel="nofollow noreferrer" href="#contact"></a>Contact</li>
      </ul>
    </div>
  </div>
</div>

Ad

Answer

header class should have these properties.

.header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("vent1.jpg");
  background-repeat: no-repeat;
  background-size:cover;

}
Ad
source: stackoverflow.com
Ad