IE always in Quirks mode
Following site i have build always load in quirks mode which then rise the box model bug for older IE.
site
I have added the document type as xhtml1-strict.dtd and there is no white spaces or BOM characters开发者_高级运维. When i change the document mode to IE7 or IE8 standers from developer tools it shows the site correctly.
I have try to change the quirks mode loading in many ways but couldnt success. If you guys also dont know how to change to quirks mode loading i would appriciate if any hack to the alligment issue i am getting can be posted.
Thank You.
View source and your first line of code is:
<?xml version="1.0" encoding="UTF-8"?>
You need DOCTYPE
to be the very first line.
Edit: You've removed the <?xml...>
, but you still have an issue. Line 1 is blank but line 2 contains an invisible character - U+FEFF
- the unicode BOM. You'll need to remove that.
Are you using Server-Side Includes or some other server technology that could be joining two files or otherwise adding to the response?
Your page starts exactly like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Lose everything before the DTD (including the blank lines before the xml declaration, which don't show correctly), and it should parse in standards mode.
Another solution is to use the X-UA-Compatible
response header, like this:
X-UA-Compatible: IE=8
(or IE=7, or IE=9)
Finally, please do read the MSDN documentation on document compatibility -- it's the definitive resource on the subject.
Update:
Since you are using PHP, and you have a spurious Unicode BOM in your source, it's almost certain that one or more of your PHP source files include a BOM. You need to save them without a BOM and without any other characters before the <?php
tag.
To make sure you got them all, write a short program that opens up PHP files and reads the first byte. If it's not '<', then something is probably wrong.
Alternatively, you can use the X-UA-Compatible
header as I mention above.
If a doctype that triggers strict mode is preceded by an xml prolog, the page shows in quirks mode.
It looks like the code output does.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en">
<head>
精彩评论