Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!
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.
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.
What happens if you put it inside another div that has a text-align value of center?
After doing some tests, this seems the way to go.
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:
<html>
<head><title>IE7 Div Centering</title>
<style type="text/css">
body {
text-align: center;
}
#content-holder {
width: 800px;
margin: auto auto;
border: 1px solid red;
text-align: left;
}
</style>
</head>
<body>
<div id="content-holder">
Quis wisi ullamcorper ex vulputate feugiat esse eum duis tincidunt. Iriure nostrud qui vulputate praesent, euismod at eros, ut. Ipsum molestie aliquam illum ad ut vel illum, suscipit delenit ullamcorper duis dolore accumsan iusto. Consequat lorem nisl wisi laoreet nostrud minim feugiat nulla luptatum, vel, nisl. Dignissim erat, dolor qui nulla sit ex veniam erat dignissim et vero consequat dolore eu augue consequat at vulputate ullamcorper.
</div>
</body>
</html>
You should be good to go as long as everything else goes inside your "content-holder" div.
The margin auto/auto thing is what's making it centered in IE7 as well. It just doesn't know what to "auto" the margins to without it being inside something that centers it horizontally.
I just tried it and taking the margin out: IE 7 and IE 6 center the div; Firefox left aligns the div.
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
IE6 left aligned
IE7 left aligned
FF2 left aligned
text-align, No margin
IE6 centered
IE7 centered
FF2 left aligned
No text-align, margin
IE6 left aligned
IE7 left aligned
FF2 centered
text-align, margin
IE6 centered
IE7 centered
FF2 centered
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.
Man I am so sick of browsers handling things so differently and having to come up with workarounds all the time. Usually IE being gay. Damn its market share!
Thanks though, I will give these a shot when I get to work tomorrow!
The text-align:center in the body tag solved it. I was really hoping there was simply something I was over-looking. I swear just using margin:auto worked in IE up until only recently.
Anyway thanks so much for all your help! Mods can go ahead and lock this now.
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.
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:
<html> <head><title>IE7 Div Centering</title> <style type="text/css"> body { text-align: center; } #content-holder { width: 800px; margin: auto auto; border: 1px solid red; text-align: left; } </style> </head> <body> <div id="content-holder"> Quis wisi ullamcorper ex vulputate feugiat esse eum duis tincidunt. Iriure nostrud qui vulputate praesent, euismod at eros, ut. Ipsum molestie aliquam illum ad ut vel illum, suscipit delenit ullamcorper duis dolore accumsan iusto. Consequat lorem nisl wisi laoreet nostrud minim feugiat nulla luptatum, vel, nisl. Dignissim erat, dolor qui nulla sit ex veniam erat dignissim et vero consequat dolore eu augue consequat at vulputate ullamcorper. </div> </body> </html>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!
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.