Height for container

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a "slideshow"  set up like this:

Styles shown inline for example comprehension:

<div style="position:relative" id="wrapper">

    <div style="position:absolute">some html</div>

    <div style="position:absolute">some html</div>


The reason for the two absolutely positioned containers is so they
overlap and can be transitioned from one to another.

The problem is the wrapper has no height unless you define it. Is there
a way to explicitly get a height without setting a height on #wrapper?


Re: Height for container

j wrote:
Quoted text here. Click to load it

No because "position:absolute" elements are taken out of the document
flow, so have no effect on the size of their container. You either have
to set a height for the wrapper or not have the children absolutely

Take care,


Re: Height for container

Quoted text here. Click to load it

Perhaps j can make do with just one of the children being absolute?

<div style="float: left; position: relative; border: 1px solid;
overflow: hidden;" id="wrapper">

<div style="position:relative; top:0; left: 0;"></div>

<div style="position:absolute; top:0; left: 0;"></div>


Re: Height for container

On 8/19/2012 6:43 PM, dorayme wrote:
Quoted text here. Click to load it

I like the idea. I thought of something similar, but not that!


Re: Height for container

Yes, you either have to let the pictures define the size, which may
not work with a slideshow, or else you have to use a definite, given
height taken from the window dimensions or some such.

I've not tried transitioning the pictures, but you may find something
useful in my javascript slideshow, documented on this page ...
... the problem being that each picture in the show, none of whose
dimensions are known in advance, needs to be displayed at the maximum
possible size within the parent container while also preserving the
correct aspect ratio (it's the latter condition that is particularly
difficult to ensure).  AFAICS, this can only be done if the parent
container is given real, actual dimensions.

There have been similar problem posed in UK Ordnance Survey's Open
Space forum regarding the sizing of maps ...
... but you may have to be a member to read the thread.

Quoted text here. Click to load it
Please always reply to ng as the email in this post's
header does not exist.  Or use a contact address at:

Site Timeline