align my site to the center

admin

Administrator
Staff member
I made a site layout using DIV tags.

i use the absolute and then added left and top apps to line it all up.

now i want to center my site.

how do i do that?Put a container div around it all, and use margin: auto; for complaint browsers, and text-align: center; (around the parent of you container tag -- probably the <body> tag) for IE 5.i got a page to centre in both planes ( X&Y) by putting everything in a div and giving the div the following style

div {position:absolute; height:420px; width:770px; top:50%; left:50%; margin:-210px 0px 0px -385px}

those dimensions work for anything from 600*800 up to pretty big - but it goes nuts in version 4 browsers and opera 5.02 - so i used the php function -> preg_match to provide opera with a different style


there are also some pretty good pages on the net that major on centering -- it's worthwhile doing a search

you can see the effect on my site ( still under development ) at <!-- w --><a class="postlink" href="http://www.oneweekofdays.com/biog">www.oneweekofdays.com/biog</a><!-- w -->
 
Back
Top