IE <DOCTYPE html> defaults to quirksmode

5.6k Views Asked by At

I'm making a wordpress theme, and in IE, on my homepage of the theme, everything is aligned left, but everything that should be centered is centered when viewing a page or post.

I have tried cutting out almost everything from the homepage and I still have not found the origin of this.

The weird thing is though, that using IE Developer Toolbar, setting the Document Mode to IE 8, makes it work like a charm. But by default, the Document Mode is Quirksmode (which makes no sense, since I use DOCTYPE html!

I tried using the X-UA Compatible metatag, but that did not do it either.

I'm afraid that I cannot provide enough code as it would simply be too much.

How can I force IE to not use Quirksmode? As I said, I tried everything I know, and everything I could find on google, and nothing helped.

Here are a few screenies that may help you understand my problem.

Document Mode: Quirksmode (DEFAULT! PROBLEM!)

enter image description here

Document Mode: IE 8 Standards (Fixes the problem, but not default!)

enter image description here

Thank you in advance!

5

There are 5 best solutions below

1
Jukka K. Korpela On BEST ANSWER

If you are testing the page locally only, the odds are that IE uses Quirks Mode just because of that. Try uploading the page on a server, test again, and post the URL if problems remain. (It could be some typo in the doctype declaration.) See also the page http://hsivonen.iki.fi/doctype/ which describes, among other things, some of the fairly confusing features of IE in the Quirks Mode issue.

1
Nate B On

Do you have the exclamation point? It should be <!doctype html>.

1
Tango Bravo On

If you can, change your doctype to

<!doctype html>

Instead of

<doctype html>

The first is the HTML5 doctype, the second doesn't exist.

0
Jeff On

I figured out what the problem was - Jukka was correct about the local environment being quirked, but to solve it, I found that I had to place the X-UA-Compatible metatag as the first thing in the Head tag for it to work. I am however accepting Jukka's answer as it is the most informative one. :)

0
Mr T On

remove any comments before the DOCTYPE tag.