Reputation: 513
I am trying to center page on IE. If I force quirk-mode by adding <!-- some comment -->
before DOCTYPE declaration margin: auto;
doesn't work properly and page is adjusted to the left. If I remove the comment page is centered, but some other elements are in mess. Could you give me some hints how to solve this?
Upvotes: 2
Views: 435
Reputation: 15168
Of course, being in quirks mode is not where you want to be so quit doing that. The problem will lie with the rest of the markup but, unless you give us a link or a jsfiddle with the complete markup, anything we say will just be a wild guess.
Does the page work in a modern browser (anything but IE)?
Upvotes: 1
Reputation: 59
You can use a 50% margin, and a negative left position with half of your element size:
position: relative;
width: 600px;
margin-left: 50%;
left: -300px;
Upvotes: 0
Reputation: 13501
Setting margin-left: auto
and margin-right: auto
for the body using CSS usually does the trick.
Forcing quirks mode probably isn't a great idea, though.
Upvotes: 1