title: Images disappear with width:100% when trying to make images responsive
body: <p>I am using position:absolute; and z-index. </p>
  
  <p>I want a large background image which fades into new images. I am going to have a form over the top of that and then they both have to be able to scroll up. (I'm just using some text at the moment instead of the form).</p>
  
  <p>I don't want the background image fixed - I want it to scroll up with whatever's on top of it.  That's why I haven't used any CSS background code because I can only find stuff which makes the background fixed.</p>
  
  <p>The problem with what I've got is I can't make the images responsive.  As soon as I put the width:100%; code anywhere the images disappear.</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-js lang-js prettyprint-override"><code>$(function() {
    $('.fadein img:gt(0)').hide();
  
    setInterval(function() {
      $('.fadein :first-child').fadeOut()
        .next('img')
        .fadeIn()
        .end()
        .appendTo('.fadein');
    }, 4000);
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.fadein {
    position: absolute;
  }
  
  .fadein img {
    position: absolute;
    left: 0;
    top: 0;
  }
  
  #bg {
    z-index: 1;
  }
  
  #fg {
    z-index: 9;
    position: relative;
  }
  
  .img-responsive {
    width: 100%;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div id="bg" class="fadein"&gt;
    &lt;img class="img-responsive" src="images/1.jpg" /&gt;
    &lt;img class="img-responsive" src="images/2.jpg" /&gt;
    &lt;img class="img-responsive" src="images/4.jpg" /&gt;
    &lt;img class="img-responsive" src="images/6.jpg" /&gt;
  &lt;/div&gt;
  &lt;div id="fg" class="container"&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
    &lt;h1&gt;text to enable scrolling&lt;/h1&gt;
  
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>