Thread: Div Alignment
View Single Post
  #11 (permalink)  
Old Sep 4th, 2006, 14:54
ukgeoff ukgeoff is offline
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Div Alignment

No. What that is saying is position the element (its right side) 50% of the window width from the right-hand side of the window.

To position something in the centre, you nedd to use the margin: auto; instruction.

You can set various combinations such as margin: auto auto; which will centre top to bottom as well. You can also use fixed measurements for say top to bottom and auto for side to side.

Have a play.

WARNING: IE 6 doesn't do this properly but it is fixed in IE7 we are told!

To get round this, you need to give the div containing the one you wish to centre the attribute definition; text-align: center;

As this has a ripple down effect, you will need to compansate for this by using text-align: left; at the next level in.
Reply With Quote