Why does margin-left:auto; margin-right:auto; not work in IE

Phreaddee

Super Moderator
Staff member
How long is a piece of string?
What version?
Are you using absolute positioning? (bad)
 

Phreaddee

Super Moderator
Staff member
Your missing my point
Doesnt center in ie.
6?7?8?9?
They each have their own unique quirks.
Which reminds me, does it have a doctype?
 

RKdesigns

New Member
Probably obvious, but had you had a width specified in the CSS for the object you are trying to center? If no specific width is set, it may make the margin attributes a little wonky. Just a suggestion.
 

RKdesigns

New Member
Probably obvious, but had you had a width specified in the CSS for the object you are trying to center? If no specific width is set, it may make the margin attributes a little wonky. Just a suggestion.

Never mind, as I just checked a project I am working on in IE 7, 8, and 9 to find out that I am having the same issue.
 

Janja

New Member
I have found in IE that sometimes you have to use text-align:center for the body for it to center.
On your container use: width:960px; margin: 0 auto; text-align:left

Hope that solves your problem.
 

Phreaddee

Super Moderator
Staff member
Funny, this seems like such a common problem, but its never happened to me.

Add a doctype
Add a reset
Keep your code simple and streamlined.
Dont use absolute positioning
And this should never be a problem...
 
Top