Link to home
Start Free TrialLog in
Avatar of GeekFreek
GeekFreekFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How do I achieve complete control of my DIV elements?

Hi

I am having trouble understand the correct way to position my div elements within the page.  Currently I seem to be battling away positioning my textual content using divs.  Howver if I move the position of one div on the page it affects all of my other divs positions.  Should I use the z index to use layering?  I thought this defeated the object slightly as using z index method forces you to use absolute positioning?

My problem is that I seem to be using the minus - property to offset my divs.  Is this the correct method?  i.e   margin-top: -200px;

Hope you can help me.
Avatar of IanTh
IanTh
Flag of United Kingdom of Great Britain and Northern Ireland image

what I do ,and it works, is do a container div for the screen size currently I do 800*600 and use absolute div positioning in that container div

are you using css?
Avatar of samj
samj

please provide the relevant code for us to help you better.
IanTh is right and that is how everyone builds pages now a days. Create a container DIV with your desired page width and then put all your other divs inside you "container". If you use CSS float properties inside your container just make sure that you "clear" css properties to prevent overlaping

see some examples from my page. first you create a structure like in my example and then you place other divs inside one of the layout divs
#container {
	width: 990px;
	margin: 0px auto;
	text-align: left;
}
this is my main container

#header { width: 990px; }
header and other header divs go in here

#layout_default div#dynamic_box_right        {width: 260px;}
#layout_default div#dynamic_box_left         {width: 160px;}
#layout_default div#dynamic_box_center       {width: 570px;}
3 columns page

#footer { width: 990px; }
footer - you put your footer content and other divs in here

Open in new window

yes I use float left on all the elements inside the container div so the dont overlap and If I want a better way of say mounting is use margins and the likes on the divs
ASKER CERTIFIED SOLUTION
Avatar of JF0
JF0
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GeekFreek

ASKER

Thanks.  I read all of the CSS positioning pages and it helped me to understand my problem.  I wasn't staing the type of positioning in my css.  I was just using the margin properties to offset them in relation to their parent containers (divs).

Thanks everyone!