Okay so I'm developing a site and I want the site to be 800 pixels wide and rest in the center of the browser regardless of size or resolution.
Previously (in IE6, Firefox, and IE7 beta) I accomplished this by enclosing all of the content in a <div> tag and applying a style to that tag.
Example:
<div class="divContent">
Stuff would go here...
</div>
And in the css file the following would be applied to get the appropriate effect:
.divContent{
width:800px;
margin-left:auto;
margin-right:auto;}
Like I said before this WAS working under IE7 in beta and continues to work under IE6 and Firefox. Now in IE7 it's simply acting as if there were no specification of the left margin. Essentially the whole page is slammed to the far left. Other than that everything else is fine.
What. The. Fuck.
EDIT: Added clarification.
Posts
http://www.thelostworlds.net/
I added it to the post. It's funny, I tell people every day at work that I need detailed decriptions of problems to solve them and I've gone and neglected that. :P
3DS: 1650-8480-6786
Switch: SW-0653-8208-4705
http://www.thelostworlds.net/
You want the div to push up against the sides of the window?
You want to center it?
To simplify things, instead of adding another div on the outside, just text-align the entire body to center, then have your main content holder div do a text-align to left, which will propagate to all the other elements underneath it.
You'll need to keep the "margin: auto auto;" for Firefox and other "standards" based browsers.
So like:
You should be good to go as long as everything else goes inside your "content-holder" div.
At least, that's been my experience.
http://www.thelostworlds.net/
So it seems that only Firefox (of the three I tested of course) needs the margin added in.
Edit:
Scientific!
No text-align, No margin
text-align, No margin
No text-align, margin
text-align, margin
My only thoughts are that IE6/7 cannot handle the margin properly and Firefox doesn't apply the text-align to block level elements, thus, you need a combination of the two to cover all bases.
Thanks though, I will give these a shot when I get to work tomorrow!
3DS: 1650-8480-6786
Switch: SW-0653-8208-4705
The first value is the top / bottom margins, which you want to be 0. The second is the left / right margins, which you want to "float".
This probably won't make a difference in most cases, but you could run into problems, so probably best to use 0.
Anyway thanks so much for all your help! Mods can go ahead and lock this now.
3DS: 1650-8480-6786
Switch: SW-0653-8208-4705