title: How do I keep my navigation bar fixed on top while scrolling?
body: <p>I tried using "position: fixed" but when I scroll down, the nav bar comes over the body. I want the navbar and the body to be separate when I scroll
  and how do I make the navbar transparent at the top and make it dark as I scroll down.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>ul {
      list-style-type: none;
      margin: 0;
      padding: 0;
  }
  nav{
   background-color: #000;
   text-align: center;
   padding: 8px;
  }
  
  nav li{
  display: inline-block;
  margin: 5px 40px 5px 40px;
  padding: 3px;
  font-size: 40px;
  }
  body{
   padding: 16px;
   margin: 10px;
   background-color: #FFE4C4;
  }
  nav li a{
   color: white;
   text-decoration: none;
   font-family: sans-serif;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;head&gt;
  &lt;title&gt;Nikola tesla&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
   &lt;div id="header"&gt;
    &lt;nav&gt;
     &lt;ul&gt;
      &lt;li&gt;&lt;a href="#early"&gt;Early Life&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#achieve"&gt;Achievements&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#quote"&gt;Quotes&lt;/a&gt;&lt;/li&gt;
     &lt;/ul&gt;
    &lt;/nav&gt;
   &lt;/div&gt;
   &lt;img src="https://s20.postimg.org/o8qt69nyl/nikolatesla.jpg" class="img-responsive .img-rounded center-block" alt="Nikola Tesla" title="Nikola Tesla"&gt;
  &lt;div class="row"&gt;&lt;h1 id="early"&gt;Early life&lt;/h1&gt;
  &lt;div class="col-md-8 col-lg-8 col-sm-12 col-xs-12"&gt;</code></pre>
  </div>
  </div>
  </p>