title: Position absolute, window resize problem even after converting to percentage
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
  
    //console.log($("#content").children().first());
    $("#content").append('&lt;div id="slider"&gt;&lt;/div&gt;');
    // initially reset
    var left = $("#content").children().first().position().left;
    var width = $("#content").children().first().width();
    $('#slider').css({
      'left': left,
      'width': width
    });
  
    var delay = 150,
      setTimeoutConst;
    $('.steps').hover(function() {
      var that = this;
      setTimeoutConst = setTimeout(function() {
        var left = $(that).position().left;
        var width = $("#content").children().first().width();
        $('#slider').stop().animate({
          'left': left,
          'width': width
        }, 300);
      }, delay);
    }, function() {
      clearTimeout(setTimeoutConst);
    });
  
  })</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#content {
    width: 95%;
    padding: 15px 2.5% 0px 2.5%;
    line-height: 0;
  }
  
  .steps {
    width: 20%;
    height: 150px;
    display: inline-block;
    background-color: white;
  }
  
  #slider {
    position: absolute;
    left: 0;
    height: 150px;
    width: 20%;
    background-color: rgb(240, 240, 240);
    display: inline-block;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
    &lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&gt;
    &lt;link rel="stylesheet" href="style.css"&gt;
    &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script src="script.js"&gt;&lt;/script&gt;
    &lt;title&gt;Document&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;div id="content-wrap"&gt;
      &lt;div id="content"&gt;
        &lt;div class="steps" style="background-color: aqua;"&gt;&lt;/div&gt;
        &lt;div class="steps" style="background-color:black"&gt;&lt;/div&gt;
        &lt;div class="steps" style="background-color: aqua;"&gt;&lt;/div&gt;
        &lt;div class="steps" style="background-color: black;"&gt;&lt;/div&gt;
        &lt;div class="steps" style="background-color: aqua;"&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I have created a slider div that slides when hovered over the div elements of class= "steps". The problem is when I resize the window the slider div is not adjusting its width. So I converted the width to percentage values. There are 5 div's (class="steps") inside a wrap, each with width=20%, along with the slider div inside the same wrap with width="20% (to match the width of steps div's). But the width of slider div is more than that of the steps div. 
  What should I do, so that the slider div is same as the width of steps div and its adjusts its width when resizing the window?</p>