Position DIV relative to containing DIV Without Moving Other Stuff

Posted by yar on Stack Overflow See other posts from Stack Overflow or by yar
Published on 2010-05-14T16:16:11Z Indexed on 2010/05/14 16:54 UTC
Read the original article Hit count: 175

Filed under:
|
|

[I'm not sure if this question has been asked, though I've looked around a bit.]

I have a DIV inside a DIV. I would like the inner DIV to have a certain position inside the outer div. I'm having some success with this

position: absolute; top: 0px;right:0px;

but all other divs are getting moved around. I just want it to float on top of the other stuff (float didn't work, of course).

Thanks!

Edit: The outer div is relative, and I'd like the inner to move with it when the browser is resized.

Edit: Sorry, I've figured out the question (but not the answer): if I use right:0px, the inner div stops moving relative to the outer div and starts moving relative to the browser window. Why would that be?

© Stack Overflow or respective owner

Related posts about css

Related posts about css-positioning