IE9强制怪癖模式&找不到解决方案

时间:2014-08-20 13:08:07

标签: html internet-explorer

IE9正在强制Quirks模式,我尝试了一些解决方案但没有成功

我尝试添加:<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

然而,这似乎无法解决问题 - 即使它直接放在<head>下面

以下是我的代码顶部:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="ie ie7 no-js" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="ie ie8 no-js" lang="en"> <![endif]-->
<!--[if IE 9 ]> <html class="ie ie9 no-js" lang="en"> <![endif]-->
<!--[if gt IE 9]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->
<!-- the "no-js" class is for Modernizr. -->
<head>
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>Availability</title>
    <link href="<%= CommonHelper.GetApplicationLocation() %>portal.css" type="text/css"
        rel="stylesheet" />
    <LINK href="<%= CommonHelper.GetApplicationLocation() %>National.css" type="text/css" rel="stylesheet" />
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Expires" content="-10">
    <link rel="shortcut icon" href="<%= CommonHelper.GetApplicationLocation() %>favicon.ico" />
        <LINK href="<%= CommonHelper.GetApplicationLocation() %>css/new-styles.css" type="text/css" rel="stylesheet">
    <LINK href="<%= CommonHelper.GetApplicationLocation() %>mobile.css" type="text/css" rel="stylesheet">
    <meta charset="utf-8" />

    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR" />
    <meta content="C#" name="CODE_LANGUAGE" />
    <meta content="JavaScript" name="vs_defaultClientScript" />
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
        <meta name = "format-detection" content = "telephone=no" />
    <meta name="google-site-verification" content="quYroxU0ZWi8YjEB9xL8j79VCAhHrSalFUnPFexYjxI" />

我在这里错过了什么吗?

由于

2 个答案:

答案 0 :(得分:1)

您需要在doc类型中指定url,请参阅此处:http://msdn.microsoft.com/en-gb/library/ie/ms535242(v=vs.85).aspx以获取触发标准模式的表格。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" http://www.w3.org/TR/html4/loose.dtd">

如评论所述,您也可以使用html5 doctype。它非常简洁:

<!DOCTYPE html>

答案 1 :(得分:1)

使用HTML文件顶部的简单<!doctype html>声明。这适用于HTML5,它很可能是您正在寻找的。

相关问题