title: CSS navbar slider highlight animation?
body: <p>I'm trying to create a top navigation bar with an underline that slides underneath each link/button on hover. I'm guessing either transitions or keyframes would work but I can't seem to make it work.</p>
  
  <p>Here's my best shot, but I can only make the parent nav or div the trigger and not the actual links themselves, and also I can't get the bar to slide to a position relative to the links (right now it's just translating 500px to the right).</p>
  
  <p>Any help would be much appreciated!</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>#header {
   position: fixed;
   background-color: rgba(255, 255, 255, 0.7);
   width: 100%;
   top: 0px;
   left: 0px;
    z-index: 1;
    text-align: center;
    padding: 15px;
  }
  
  .nav ul li {
    font-family: 'Exo', sans-serif;
    text-transform: uppercase;
    list-style-type: none;
    display: inline;
    padding: 11px;
  }
  
  .slider {
   position: absolute;
   bottom: 0px;
   left: -50px;
   width: 50px;
   height: 5px;
   background-color: rgba(52, 152, 219, 0.3);
   transition-property: transform;
   transition-duration: 300ms;
   transition-timing-function: ease-in-out;
   transition-delay: 0s;
  }
  
  .nav:hover .slider {
     transform: translate(500px);
  }
  
  .nav ul li a {
    text-decoration: none;
    margin: 0px 30px 0px 30px;
    color: rgba(0, 0, 0, 0.5);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;header id="header"&gt;
         &lt;nav class="nav"&gt;
          &lt;ul class="list"&gt;
                &lt;div class="slider"&gt;&lt;/div&gt;
           &lt;li class="btn"&gt;&lt;a href="#home"&gt;Home&lt;/a&gt;&lt;/li&gt;
           &lt;li class="btn"&gt;&lt;a href="#about"&gt;About&lt;/a&gt;&lt;/li&gt;
           &lt;li class="btn"&gt;&lt;a href="#portfolio"&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
           &lt;li class="btn"&gt;&lt;a href="#contact"&gt;Contact&lt;/a&gt;&lt;/li&gt;
          &lt;/ul&gt;
         &lt;/nav&gt;
         &lt;/header&gt;</code></pre>
  </div>
  </div>
  </p>