我无法用css解决错误:
来自“http://localhost:63342/static/style.css””的资源由于MIME类型(“text/html”)不匹配而被阻塞(X Options: nosniff)。
文件夹结构是:
root
|-> content
-| index.html
|-> static
-| style.css
-| script.js在index.html中,我导入样式表:
<link href="../static/style.css" rel='stylesheet' type='text/css'>但这会导致控制台中出现上述错误。错误声称我的类型是'text/html'?
我的css文件:
html {
height: 100%;
}
body {
min-height: 100%;
}
.section {
display: none;
margin-top:40px;
border-top:1px solid #ccc;
}有什么问题吗?
我以类似的方式导入js脚本,它运行得很好:
<script type="text/javascript" src="../static/jct.js"></script>发布于 2020-08-13 16:29:23
响应头应该包含"text/css“而不是"text/html":
Content-Type: "text/css"试着使用:
<link type="text/css" href="../static/style.css">你在用哪台服务器?
https://stackoverflow.com/questions/63398165
复制相似问题