Setting height of a relatively positioned DIV

Posted by Salman A on Stack Overflow See other posts from Stack Overflow or by Salman A
Published on 2010-04-13T06:35:21Z Indexed on 2010/04/13 6:43 UTC
Read the original article Hit count: 404

Filed under:
|

I have following HTML+CSS markup:

<div id="protofade" style="position: relative;">
    <div style="position: absolute;"><img src="slide-01.jpg"></div>
    <div style="position: absolute;"><img src="slide-02.jpg"></div>
    <div style="position: absolute;"><img src="slide-03.jpg"></div>
</div>

Notice that the slides are absolute-positioned inside a relative-positioned element so that the top-left corners of all slides are aligned together. All slides are equal height, but the height is not pre-determined hence this problem: the "protofade" div does not have a height. Is there any CSS trick that can make this div as tall as the first slide without explicitly specifying height: NNpx.

© Stack Overflow or respective owner

Related posts about css-positioning

Related posts about css