Re: Relative absolute position in blocks

Fredrik,

If I understand what it is you are trying to do, you are looking for one of 
the more obscure, peculiar, nonintuitive parts of CSS, but one with which I 
happen to have some experience.

Try adding a position attribute to the containing block.  You don't actually 
have to position it; if you want it to appear as normal, use "position: 
relative" without edge attributes.  Then anything positioned absolutely 
within it will be absolutely relative to it.


Kind regards,

Brian Sexton



----- Original Message ----- 
From: "Fredrik Söderberg" <mcdrill@acc.umu.se>
To: <www-style@w3.org>
Sent: Sunday, August 29, 2004 9:13 AM
Subject: Relative absolute position in blocks


>
> I hope this hasn't already been discussed or I am really stupid,
> but I couldn't find anything regarding this issue after a quick
> search through the archives.
>
> I am looking for a way to set absolute position, but relative
> to the box it is in.
>
> For example, if I have a box <div> and inside that box I have
> another <div>. Now what would be wonderful would be if the inner
> <div> position could be set so left: 10px; would generate this
> box 10px left of the box border it is currently in. And if I
> now take this inner <div> and move it to somewhere else, it will
> always have the position 10px to the right of the left border of
> whatever box it is in.
>
> I was at first hoping position: relative would do this, but it
> ofcourse did not. As far as I can see there is no way to achive
> what I want in current CSS. Or?
>
> If not, wouldn't this be a very excellent feature? It would be
> much easier to modulize the layout.
>
> Even if I haven't found any info on this, I kind of expect an
> answer that says it has already been discussed etc, since to me
> it sounds like it should already be possible. Even so, will be
> glad to get any response :)
>
> /Fredrik
>
>
> 

Received on Sunday, 29 August 2004 16:28:23 UTC