View Full Version : Internet Explorer Not centering page

Dec 4th, 2008, 04:18 PM
Hi Guys,

I am working on a project. I have created my pages, and everything is correct in the browsers.

Now I am working on a new page which is packed with PHP and Javascript. Now this page will not centre in the page in IE7 but everything is fine in FF.

I don't understand it and cannot figure out what is wrong.

Any ideas?


Dec 4th, 2008, 04:28 PM
Most probably you don't have DOCTYPE at all or having an invalid DOCTYPE. Fix your page with the right DOCTYPE (http://www.alistapart.com/stories/doctype/).

PS: also validate your page (http://validator.w3.org) and fix the rest of errors, if any.

Dec 4th, 2008, 04:30 PM
We'll need a link or your code in order to diagnose your problem.

For starters, though, have you tried adding text-align:center to your body code?

body {

It takes advantage of a bug in IE whereby the browser incorrectly centers a block-level container div using an attribute intended for inline elements.

Dec 4th, 2008, 04:34 PM
body {
} but that's only required in quirks mode and not in standard mode.

Dec 4th, 2008, 04:37 PM
PMJI, but I was told that you would be in quirks mode with a DOCTYPE of trans, only strict would take you out of it. I don't think so, but would like your opinion on it.

Dec 4th, 2008, 04:40 PM
Hi Guys,

Did the body text align thing and it worked fine.


Dec 4th, 2008, 04:41 PM
It's been explained well in the sticky, http://www.codingforums.com/showthread.php?p=182254#post182254. Any complete DOCTYPE would make in correct in IE6 and higher.

Dec 4th, 2008, 04:43 PM
The doctype should be HTML 4.0. I have validated my CSS and there are no errors.A valid CSS can't make your site perfect, without a valid markup. See http://validator.w3.org/check?uri=http%3A%2F%2Fwww.all4bikers.com%2Fa4b_2009%2Ftheory%2Fmotorbiketheorytest_NEW.php&charset=%28detect+automatically%29&doctype=Inline&group=0