【发布时间】:2019-09-15 02:54:24
【问题描述】:
当尝试将样式应用于网站上的特定页面时(完全相同的样式在网络服务器上的其他地方也可以使用),我收到以下错误
拒绝应用来自“style.css”的样式,因为它的 MIME 类型 ('') 不是受支持的样式表 MIME 类型,并且启用了严格的 MIME 检查。
我已经尝试在本地运行该文件,而只将文件导入 HTML 并且它工作得非常好。我也在同一网络服务器上的空白页面上尝试过这个,再次,它工作得很好。
由于担心它是文件的编码,我还替换了该文件,并且我已经从文件中删除了所有 cmets (As per this answer)。
CSS文件的全部内容如下
#Main_ctl01_lst {
width: 320px;
}
#Main_ctl02_txt{
height: 25px;
width: 200px;
}
#Main_ctl03_txt {
width: 250px;
}
.label #Main_ctl04_lbL:fter {
content: "*";
font-family: inherit;
font-size: 9pt;
color: red;
}
.label #Main_ctl05_lbl:after {
content: "*";
font-family: inherit;
font-size: 9pt;
color: red;
}
.label #Main_ctl06_lbl:after {
content: "*";
font-family: inherit;
font-size: 9pt;
color: red;
}
.label #Main_ctl07_lbl:after {
content: "*";
font-family: inherit;
font-size: 9pt;
color: red;
}
.label #Main_ctl08_lbl {
font-size: 0;
}
.label #Main_ctl09_lbl:before {
content: "Content";
font-family: inherit;
font-size: 9pt;
}
.label #Main_ctl010_lbl:after {
content: "*";
font-family: inherit;
font-size: 9pt;
color: red;
}
.label #Main_ctl110_lbl {
font-size: 0;
}
.label #Main_ctl11_lbl:before {
content: "Content";
font-family: inherit;
font-size: 9pt;
}
.label #Main_ctl13_lbl:after {
content: "*";
font-family: inherit;
font-size: 9pt;
color: red;
}
/* Line 3*/
.label #Main_ctl114_lbl {
font-size: 0;
}
.label #Main_ctl115_lbl:before {
content: "*";
font-family: inherit;
font-size: 9pt;
}
/* Line 4*/
.label #Main_ctl16_lbl {
font-size: 0;
}
.label #Main_ctl17_lbl:before {
content: "Content";
font-family: inherit;
font-size: 9pt;
}
.label #Main_ctl118_lbl {
display: none;
}
.input #Main_ctl19_dp {
display: none;
}
.input1 {
visibility: hidden;
}
.input2 {
display: none;
}
.label {
display: none;
}
body {
background-image: url(https://example.com/image.png);
background-color: rgb(255,0,0);
background-color: #FF0000;
}
以及网页的头部代码
<head>
<script src="/Content/jquery-1.9.1.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/Content/jquery-ui-1.8.14.custom.css">
<script src="/Content/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
<script src="/Content/Test.Scripts.js" type="text/javascript"></script>
<script src="/Content/Reflection.js" type="text/javascript"></script>
<script src="/Content/CollapsibleCheckBoxList.js" type="text/javascript"></script>
<script src="/Content/Scripts.jQuery.Extensions.js" type="text/javascript"></script>
<title>Test</title>
<link rel="shortcut icon" media="all" type="image/x-icon" href="/Content/favicon.ico">
<script type="text/javascript" src="/content/jquery.autotab-1.1b.js"></script>
<script type="text/javascript" src="/content/jquery.calculation.min.js"></script>
<script type="text/javascript" src="/content/jquery.format.1.05.js"></script>
<script type="text/javascript" src="/App_Templates/FrontEnd.Test/TestScript.js"></script>
<link href="/App_Templates/Common/_Reset.css" type="text/css" rel="stylesheet">
<link href="../App_Templates/FrontEnd.Test/Standard.css" type="text/css" rel="stylesheet">
<link href="../App_Templates/FrontEnd.Test/Template.css" type="text/css" rel="stylesheet">
<link href="/App_Templates/Common/Menus.css" type="text/css" rel="stylesheet">
<!--[if lte IE 8]>
<link href="../App_Templates/Common/IE8.css" rel="stylesheet" type="text/css" />
<![endif]-->
<link href="/WebResource.axd?d{{removed}}" type="text/css" rel="stylesheet"><link type="text/css" href="/s3?Styles.CssFile/{{culprit_file}}.css&{{removed}}" rel="stylesheet">
</head>
如果脚本按预期工作,我希望看到红色背景。如前所述,其他地方就是这种情况,但这个特定网页上没有。
实际上,由于 MIME 类型问题,文件中没有任何内容被加载。
【问题讨论】:
标签: html css mime-types