title: Setting DIV height based on height of absolutely positioned child IMG
body: <p>I have a relatively positioned div with a number of absolutely positioned images within. 
  The div and image are both set with a width of 100% to fill the layout (which is fluid), but I need to be able to set the height of the parent DIV so that it will show the whole image. </p>
  
  <p>I've tried approaches similar to <a href="https://stackoverflow.com/questions/8184919/css-relative-positioned-parent-div-not-stretching-to-absolute-child-div-height">CSS - relative positioned parent div not stretching to absolute child div height</a> and <a href="https://stackoverflow.com/questions/5359574/resize-parent-div-to-match-absolutly-positioned-child-div-height">Resize parent div to match absolutly positioned child div height</a>, but the height of the child image is return as 0. </p>
  
  <p>I've even tried clearfixes, even though I'm not using floats.
  Absolute positioning is required for these images, so I can't resolve with floats. </p>
  
  <p>Any ideas?</p>
  
  <p><a href="http://jsfiddle.net/sdowswell/XmVu7/1/" rel="nofollow noreferrer">http://jsfiddle.net/sdowswell/XmVu7/1/</a></p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;div id="banner"&gt;
      &lt;a href="newpage.html"&gt;&lt;img src="images/banners/image1.jpg" /&gt;&lt;/a&gt;
      &lt;a href="othernewpage.html"&gt;&lt;img src="images/banners/image2.jpg" /&gt;&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>CSS</strong></p>
  
  <pre><code>#banner {
      width:100%; 
      position:relative; 
  }
  
  #banner&gt;a&gt;img {
      width:100%; 
  }
  </code></pre>
  
  <p><strong>JQUERY</strong></p>
  
  <pre><code>$(document).ready(function(){
  
          $('#banner').css('overflow', 'hidden');
          $('#banner img')
              .css('position', 'absolute')
              .css('display', 'none');
      $('#banner img').first().css('display', 'block');
  });
  </code></pre>
  
  <p>​</p>
  
  <p>(Editted to get rid of irrelevant extra stuff. Editted again to include jQuery.)</p>