简体   繁体   English

IE始终处于怪癖模式

[英]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. 在我已建立的网站下面,始终以怪癖模式加载,然后出现较旧IE的框模型错误。

site 现场

I have added the document type as xhtml1-strict.dtd and there is no white spaces or BOM characters. 我已将文档类型添加为xhtml1-strict.dtd,并且没有空格或BOM字符。 When i change the document mode to IE7 or IE8 standers from developer tools it shows the site correctly. 当我从开发人员工具将文档模式更改为IE7或IE8标准文件时,它会正确显示该站点。

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. 您需要DOCTYPE作为第一行。

Edit: You've removed the <?xml...> , but you still have an issue. 编辑:您已经删除了<?xml...> ,但是仍然存在问题。 Line 1 is blank but line 2 contains an invisible character - U+FEFF - the unicode BOM . 第1行为空白,但第2行包含一个不可见字符U+FEFF - 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. 丢失DTD之前的所有内容 (包括xml声明之前的空白行,它们不能正确显示),并且应在标准模式下进行解析。

Another solution is to use the X-UA-Compatible response header, like this: 另一个解决方案是使用X-UA-Compatible响应标头,如下所示:

X-UA-Compatible: IE=8

(or IE=7, or IE=9) (或IE = 7,或IE = 9)

Finally, please do read the MSDN documentation on document compatibility -- it's the definitive resource on the subject. 最后,请务必阅读有关文档兼容性MSDN文档 -这是该主题的权威资源。

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. 由于您使用的是PHP,并且您的源中包含伪造的Unicode BOM,因此几乎可以确定一个或多个PHP源文件中包含BOM。 You need to save them without a BOM and without any other characters before the <?php tag . 您需要<?php标记之前保存它们, 而不使用BOM表和其他任何字符

To make sure you got them all, write a short program that opens up PHP files and reads the first byte. 为确保所有内容均正确无误,请编写一个简短的程序来打开PHP文件并读取第一个字节。 If it's not '<', then something is probably wrong. 如果不是'<',则可能是错误的。

Alternatively, you can use the X-UA-Compatible header as I mention above. 另外,您也可以使用我上面提到的X-UA-Compatible标头。

If a doctype that triggers strict mode is preceded by an xml prolog, the page shows in quirks mode. 如果触发严格模式的doctype前面带有xml prolog,则该页面将以怪异模式显示。

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM