jc_gmk
10-03-2007, 03:07 PM
Does anyone know how to vertically align a div within another div?
without setting the height of the parent div!
I have two child divs that have variable heights (dynamically generated), they are in a parent div that has a variable height depending on the size of either one of the child divs (the child divs are side by side, so one could be bigger than the other)
e.g.
if 'child div 1' is 800px in height and 'child div 2' is only 100px high
i would like 'child div 2' vertically aligned in the middle.
'child div 1' would would stretch the parent div to 800px so wouldn't need to be vertically-aligned.
Hope this makes sense!
without setting the height of the parent div!
I have two child divs that have variable heights (dynamically generated), they are in a parent div that has a variable height depending on the size of either one of the child divs (the child divs are side by side, so one could be bigger than the other)
e.g.
if 'child div 1' is 800px in height and 'child div 2' is only 100px high
i would like 'child div 2' vertically aligned in the middle.
'child div 1' would would stretch the parent div to 800px so wouldn't need to be vertically-aligned.
Hope this makes sense!