【问题标题】:CSS was ignored due to mime type mismatch由于 mime 类型不匹配,CSS 被忽略
【发布时间】:2012-07-10 08:47:09
【问题描述】:

我测试过的每个浏览器都忽略了我的站点样式表。在 IE9 - SEC7113 上测试时出现此错误:由于 mime 类型不匹配,CSS 被忽略

这是引用它的标头中的 html。如果您需要更多信息,请告诉我。

    <!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" xml:lang="en">
    <head runat="server">
    <title></title>

    <!--The style sheet below is the one being ignored-->
    <link rel="stylesheet" type="text/css" charset="UTF-8" href="Styles/Site.css"  />

    <!-- Skin CSS file -->
    <link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/assets/skins/sam/skin.css" />
    <!-- Utility Dependencies -->
    <script src="http://yui.yahooapis.com/2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> 
    <script src="http://yui.yahooapis.com/2.9.0/build/element/element-min.js"></script> 
    <!-- Needed for Menus, Buttons and Overlays used in the Toolbar -->
    <script src="http://yui.yahooapis.com/2.9.0/build/container/container_core-min.js">     </script>
    <script src="http://yui.yahooapis.com/2.9.0/build/menu/menu-min.js"></script>
    <script src="http://yui.yahooapis.com/2.9.0/build/button/button-min.js"></script>
    <!-- Source file for Rich Text Editor-->
    <script src="http://yui.yahooapis.com/2.9.0/build/editor/editor-min.js"></script>
    <script src="http://yui.yahooapis.com/2.9.0/build/editor/simpleeditor-min.js"></script>


</head>

【问题讨论】:

  • 这是在您自己的个人服务器上吗?它可能没有发送具有正确 mime 类型的 CSS 文件。
  • 你的服务器是什么?你能换the .htaccess files吗?
  • 尝试使用绝对路径而不是相对路径
  • 你为什么需要charset="UTF-8"?当它被请求时,它实际上不会影响样式表的 MIME 类型。

标签: html css mime-types mime-message


【解决方案1】:

您的服务器显然发送了错误的媒体类型信息。但是,这无法从您的服务器外部进行验证。

【讨论】:

    【解决方案2】:

    我想通了,我刚开始工作的公司在设置我的计算机时未能为 IIS 安装静态内容功能。所以它忽略了我所有的样式表、图像和链接。

    【讨论】:

      【解决方案3】:

      我的文件名中有错字,在链接和文件中都拼写为 myFile.ccs vs myFile.css。 Firefox 很好,但是 IE 返回了这个错误。

      【讨论】:

        【解决方案4】:

        我意识到,在我的新 Windows 10 机器上,我无法在本地 IIS 中启用静态内容。为此,请从控制面板转到“打开或关闭 Windows 功能”,然后导航到以下位置:

        确保选中此“静态内容”选项。然后,以管理员身份打开命令窗口并执行 iisreset。

        繁荣,已修复。

        【讨论】:

          猜你喜欢
          • 2013-03-14
          • 2013-10-05
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-08-11
          • 1970-01-01
          • 2013-05-04
          相关资源
          最近更新 更多