How to center site in browser windo

msbrink / 2008-06-26 11:04:10   

Hi!

I was wondering if anyone have built a centered indexhibit site. By that I mean the site centers whenever the user changes the size of his browser window like : http://wordpress.org/
And if so, do ya have any pointers as to how you acheived this?

Thank You

msbrink / 2008-06-26 11:14:35   

I found this site that does a pretty good job explaining the code needed. In indexhibit though it appears to me that the container tag is wrapped around all the other tags. Anyway I'm no coder so this is just me rambling about.

I've tried the example :
body { text-align: center; }

div#container
{
margin-left: auto;
margin-right: auto;
width: 50em;
text-align: left;
}

But it just puts a scroll in the #menu and #content sticks to the right side of the browser. So I thought what if I added


<div class='container' align='center' text-align='left'>

to site/index.php...but to no avail

msbrink / 2008-06-26 11:16:08   

I meant to say : In indexhibit though it appears to me that the container tag isn't wrapped around all the other tags.

AntoineLafontaine / 2008-07-02 10:37:57   

You should first remove the fixed positioning of the menu (and any absolute positioned elements. Then apply your css (which is correct btw) to the body of the page, not the container class since there's actually 2 of those class in a clean indexhibit install (the menu and the content div).

The best would be to add an extra div after the body that would include the menu and content. (of course, you still need to remove absolute and fixed positioning since it just removes those parts from the normal rendering flow of the page).

The with is set in em, so it will change depending on your body's font size... be sure that's what you want. For a fixed width, use pixel based units. (an em based layout would be a nice thing though)

This thread has been closed, thank you.