当我将我的项目上传到 Azure 时,我注意到我的 CSS 元素没有被应用到 IE 上。
当我在本地计算机上查看相同的网页以及在 Chrome 中查看 Azure 上的项目时,将应用它们。
我在我的 aspx 中引用 CSS 文件:
<link href="~/main.css" rel="stylesheet" type="text/css" />
我也试过:
<link href="/main.css" rel="stylesheet" type="text/css" />
当我将我的项目上传到 Azure 时,我注意到我的 CSS 元素没有被应用到 IE 上。
当我在本地计算机上查看相同的网页以及在 Chrome 中查看 Azure 上的项目时,将应用它们。
我在我的 aspx 中引用 CSS 文件:
<link href="~/main.css" rel="stylesheet" type="text/css" />
我也试过:
<link href="/main.css" rel="stylesheet" type="text/css" />
有时这是 IE 中的一个兼容性功能。包含此元标记以将其关闭
<meta http-equiv="x-ua-compatible" content="ie=edge" />
我还偶然发现了另一种方法
添加一个 http 标头(在 asp.net 中,这在 global.asax 中,如果安装了 chrome=1,则启用 chromeframe):
protected void Application_BeginRequest()
{
Response.Headers.Add("X-UA-Compatible", "IE=edge, Chrome=1");
}