Absolute positining of nested custom controls

N

Nick Stansbury

Hi,

I am trying to produce a series of web controls which will always
position themselves at the very top left hand corner of the page. However
I've come across a problem that should have been obvious - which is that
when the controls are nested several layers deep inside div's (which is
unavoidable) - up to n-layers deep - they position themselves absolutely -
but only relative to the top left hand corner of their parent div:

Now I know that if every div the tree is positioned absolutely I can
use the offsetParent property in a dhtml function to recurse up the tree and
add them together to correctly position the div to the top left - however I
can't find a way of continuing to recurse up the tree using the offset
parent if any of the div's aren't positioned absolutely.

Is there an easy way to get around this problem? Am I missing something
obvious? Can anyone help?

Thanks

Nick

i.e

<div id=myWebControl1>
<span>
Label text:
</span>
<input tpe=text>bah</input>
<div id=mWebControl2>
<div id=mWebCotrol3> <!-- Take this control and position it
absolutely to the top left hand corner at 0,0-->
</div>
</div>
</div>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top