Help with div?

Associate
Joined
17 Mar 2004
Posts
1,562
Hi all.

Right, ive created a div for my latest news section on the website.

However I can't "position" it.

http://offlimitscrew.co.uk/dzire1/

if I use absoloute position it just sticks it to the same spot no matter how much I change the top/left/right variables etc.

Also I have to insert lots of <br>'s to make room for it...The div it is in dosen't have a height so surely it should be able to "drop down" and accomdate it?

CSS sheet is here
http://offlimitscrew.co.uk/dzire1/screen.css

1 option i've thought of is splitting the homepage into 2 collums so I could do it that way?

I want it at the top right of the content area but with a margin of around 5px at the top/sides.

Would be really grateful if one of you guys could have a look and work out where im going wrong.

Cheers.
 
If you absolutely position an element it is removed from the document flow. This means that it does not affect any neighbouring elements, and thus the container element will not expand to accomodate it.

You can give the container an overflow: auto; if you wish it to expand to fit.

As for positioning:
Code:
div.content {
position: relative;}

#latestnews {
position: absolute;
right: 5px;
top: 5px;}
Absolutely positioned elements are placed relative to the edges of the nearest 'positioned' ancestor. You can give an element 'position' with the position: relative; property.
 
Back
Top Bottom