【问题标题】:CSS file not being loaded/applied when ASP.NET project is uploaded to Azure将 ASP.NET 项目上传到 Azure 时未加载/应用 CSS 文件
【发布时间】:2013-08-04 06:52:55
【问题描述】:

当我将我的项目上传到 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" />

【问题讨论】:

    标签: asp.net css internet-explorer azure


    【解决方案1】:

    有时这是 IE 中的一个兼容性功能。包含此元标记以将其关闭

    &lt;meta http-equiv="x-ua-compatible" content="ie=edge" /&gt;

    我还偶然发现了另一种方法

    添加一个 http 标头(在 asp.net 中,这在 global.asax 中,如果安装了 chrome=1 也会启用 chromeframe):

    protected void Application_BeginRequest() 
    { 
        Response.Headers.Add("X-UA-Compatible", "IE=edge, Chrome=1"); 
    } 
    

    【讨论】:

    • 谢谢!这部分有效,这很奇怪..我的大多数样式都应用了,除了设置为“小”但仍保持“中等”的字体大小。如果我将整个样式表复制到 .aspx 文件中,就会设置它,但我宁愿不这样做。
    • 我使用了 并且成功了 =]
    猜你喜欢
    • 1970-01-01
    • 2020-03-01
    • 2016-08-28
    • 1970-01-01
    • 2019-04-05
    • 1970-01-01
    • 2013-08-13
    • 2015-08-31
    • 2020-01-12
    相关资源
    最近更新 更多