I can't center the page in IE. Have tryed margin: 0 auto; HTML: But that only works in FF. Please help me fast. Thanks, Leox
Here's another method: body { text-align:center; } #Wrapper { margin:0px auto; text-align:left; } Code (markup):
This is how i wrote: body { font-family: Trebuchet MS, Verdana, Arial; font-size: 12px; width: 640px; margin-left: auto; margin-right: auto; } HTML: and it doesn't work.
Add what qube99 wrote. Older IE's don't obey margin auto. Broken box model. Even though you might not really want the text centered, this is IE5.5 (and 6?)'s way of centering stuff. To keep the text to the left (if that's what you want), look at what qube wrote for #Wrapper... this moves the text back while keeping the page centered in old IE. Try it.
margin: 0 auto; works in IE6 if you are in standards compliant mode - text-align:center works for IE in quirks mode or IE 5.x I usually state both for the page wrapper on fixed width layouts, but say the heck with it on contents as I see little or no IE 5.x traffic anymore and they can live with a 'degraded' appearance. (if they can't live with it, they can upgrade to one of the free browsers that doesn't suck) Question: do you have a valid doctype without a XML prolog? Is it the first thing in the document with NOTHING before it, even blank lines being verboten? If the answer is no, you are in quirks mode and are going to spend hours if not weeks hacking around stuff for IE 6 that should only take a few seconds, minutes on the outside.
If you want to support IE 5.x which most people don't anymore. If you don't care about IE 5.x, then you can safely just use the width and auto left/right margins on the body and be done with it.