FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

CSS help positioning div

 


alalex
Hi everyone,
I have a web where there is a div positioned absolutely with a fixed width but a variable height. When I started the web, it was enough, but now I need to place another div of fixed height and width below that one. The problem is that I need to be able to position it with css so that its top attribute depends on where it finished the div I mentioned before.
I would like it to be 10px below, and I dont know how...

I thought of placing both of them in the same div, and position the general one, but the site has grown too much and now it is just impossible to do that Sad

Thanks Wink
sonam
CSS:
Code:
.absolute{
position : absoulute;
...
}
.relative{
position : relative;
top : 10px;
...
}


HTML
Code:
<div class="absolute">
   something
</div>
<div class="relative">
    something again
</div>


I didn't check. It is too late and I am going to sleep. If is not work I will come back.

Sonam
alalex
Thanks, I tried it but it doesn't work as expected, the problem is that the other div's position is set to absolute, and instead of taking its position for the relative positioning it is setting it to relative to the only static element on the page, the header...

What I was trying to find was a way to set the top of this element 10 pixels below the other layer, but I am searching google and I'm guessing that that's not possible... Sad
sonam
Are this site online how we can see html and css.

Sonam
alalex
Well I ended up putting both divs in a container, which is the one positioned absolutely, and then the other ones inside are just with a margin-top:10px so that they are 10px from each other..

The site is up, yes, it is in spanish, but you can see it anyways: http://kdams.es/test.php
Below the header, to the left you'll see two layers, those are the ones I was talking about

Thanks anyways! Wink
sonam
Yes, you can solve this with one outside container. The another way is float : left; but I didn't look too deep in your code, and this second solution need time for right css coding.

Sonam
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.