今天无意中看到百度的页面代码,想到了一种声明写法:

<!DOCTYPE html>
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<![endif]
-->
<!--[if IE 7]>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<![endif]
-->
<!--[if IE 6]>
<meta http-equiv="X-UA-Compatible" content="IE=6" />
<![endif]
-->

<!DOCTYPE html>是HTML5的声明,主流的游览器中只有IE8及以下版本不支持,这样IE会进入Quirks模式。但之后的声明可以强制指定IE的呈现模式,所以<!DOCTYPE html>声明对IE就无影响。

HTML5并没有XHTML那么严格,对于一般的xhtml页面,基本都不通完全通过W3C验证标准,而改为HTML5声明后基本都能过。

相关文章:

  • 2022-12-23
  • 2021-07-29
  • 2021-12-02
  • 2021-12-31
  • 2021-07-28
  • 2022-12-23
  • 2021-07-15
  • 2021-05-24
猜你喜欢
  • 2022-12-23
  • 2021-08-15
  • 2021-12-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案