Is there a way to position a div on top of a div?

RandomFool

Diamond Member
Dec 25, 2001
3,913
0
71
www.loofmodnar.com
I've got this hidden div that I only want to appear when called by a JavaScript function. I was using relative positioning which messed up my layout because the hidden div expands the height of whichever div I put it in to match where it would normally end and then moves the hidden div to the correct position, leave a lot of white space below it. I played with absolute positioning but I couldn?t get the div to stay horizontally aligned when you resize the page because I have everything centered. I'm going nuts trying to figure this out.
 

esun

Platinum Member
Nov 12, 2001
2,214
0
0
Why not just set the parameters (location and size parameters, that is) of the top div to be the same as that of the lower div when you make it visible? Haven't tried it myself but it should be easy to do in Javascript.
 

RandomFool

Diamond Member
Dec 25, 2001
3,913
0
71
www.loofmodnar.com
I figured it out. I ended up setting the containing div to position: relative; and then setting the hidden div to position:absolute; top:0px; left: 0px; which placed it in the top corner of the div and worked rather well.