centering a css page
Posted: 27 January 2006 04:53 PM   [ Ignore ]
Newbie
Rank
Total Posts:  2
Joined  2006-01-27

I’m working with design that is 760px wide and is not a liquid design.  I’m not sure how I center the design on the page, any help would be great.

Ray

Profile
 
 
Posted: 29 January 2006 06:26 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  1
Joined  2006-01-29

use… margin: auto;

like…

body {
text-align:center;
}

#container {
margin: auto;
}

Profile
 
 
Posted: 09 February 2006 08:51 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  2
Joined  2004-11-19

You can also try

body {
position
:relative;
}
#container {
position:relative;
top:0px;
left:50%;
width:760px;
margin-left:-380px;

I have found this to work in IE, FF, and several versions of Netscape

Profile
 
 
Posted: 09 February 2006 09:50 PM   [ Ignore ]   [ # 3 ]
Newbie
Rank
Total Posts:  4
Joined  2006-02-07

lol

body { width: 760px; margin: 0 auto; }

You don’t need a container and you don’t need to mess with positions. You need to use margins.

Profile
 
 
Posted: 10 February 2006 06:52 PM   [ Ignore ]   [ # 4 ]
Newbie
Rank
Total Posts:  9
Joined  2005-11-29

This is an excerpt from the stylesheet at Jacksonville Apartments... [http://firstcoastapartments.com/css/jims.css] - it is an entire CSS redo of their [home page only so far] table based design. Compare it to the original table based design if you like… http://firstcoastapartments.com/index.php

I love CSS!

body{
margin
:0;
padding:0;
text-align:center;
}

div
#outer{
position:relative;
width:780px;
margin:0 auto;
padding:0;
text-align:center;

Hope this helps you.

Profile
 
 
Posted: 10 February 2006 08:33 PM   [ Ignore ]   [ # 5 ]
Newbie
Rank
Total Posts:  2
Joined  2006-01-27

Much thanks to all who helped me.

Ray

Profile
 
 
Posted: 11 February 2006 08:29 PM   [ Ignore ]   [ # 6 ]
Newbie
Rank
Total Posts:  3
Joined  2006-02-11

Just set the left margin to ‘auto’ and right margin to ‘auto’ and that will centre your div.

SDM

Profile