CSS: fit relative positioned parent to height of absolute positioned child
I am trying to build a simple slideshow. So far, the basic markup looks like this: <h1>My Slideshow</h1> <p>This paragraph behaves as expected.</p> <div class="slide-container"> <div class="slide"> <h2>First Slide</h2> <p>Some stuff on this slide…</p> </div> <div class="slide"> <h2>Second Slide</h2> <p>And some more stuff here…</p> </div> </div> <p>This paragraph will disappear beneath the stacked images.</p> This is the corresponding CSS: .slide-container { position: relative; } .slide { position: absolute; top: 0; /* just for the looks */ width: 20em; padding: 0 1em; border: 1px solid