PDA

View Full Version : Internet Explorer Not centering page



winnard2008
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?


Danny

abduraooft
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.

BoldUlysses
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 {
text-align:center;
}

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.

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

jerry62704
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.

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

Did the body text align thing and it worked fine.


Thanks

abduraooft
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.

abduraooft
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