Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 为什么是';这个css文件不能工作吗_Html_Css_Mime Types - Fatal编程技术网

Html 为什么是';这个css文件不能工作吗

Html 为什么是';这个css文件不能工作吗,html,css,mime-types,Html,Css,Mime Types,我试图在云存储服务上托管我的css文件,但当我将其链接到我的网站时,它没有被执行, 所以我创建了一个小的css,它只是改变背景,但它不起作用。 它的服务器似乎有一些问题,你能告诉我可能有什么问题,以及如何使用它作为css吗 css文件的链接 HTML代码 <link href="http://copy.com/Kgs8EaMF71Qa7zqo/style.css" rel="stylesheet" type="text/css" /> 我认为,这可能是由于MIME类型,您上传时假设

我试图在云存储服务上托管我的css文件,但当我将其链接到我的网站时,它没有被执行, 所以我创建了一个小的css,它只是改变背景,但它不起作用。 它的服务器似乎有一些问题,你能告诉我可能有什么问题,以及如何使用它作为css吗 css文件的链接 HTML代码

<link href="http://copy.com/Kgs8EaMF71Qa7zqo/style.css" rel="stylesheet" type="text/css" />

我认为,这可能是由于MIME类型,您上传时假设它将作为css文件工作,但其实际MIME类型将是纯文本/纯文本,但需要MIME类型才能使其作为css文件工作

所以它不会起作用。

至少Gecko有一个安全特性:所有来自不同来源的样式表都必须使用
text/css


事实上,您的文件被用作
文本/普通
,因此其中的规则被忽略。

这个文件对我来说非常有效。 下面是带有输出的html代码

<html>
<head>
<link href="http://copy.com/Kgs8EaMF71Qa7zqo/style.css" rel="stylesheet" type="text/css" />

</head>
<body>
</body>
</html>


由于安全原因,copy.com上托管的MIME类型的文件被用作
text/plain
因此,像copy.com上的CSS文件这样的普通链接将不起作用

但是如果你仍然想在这个云存储服务上托管你的css文件,你可以在你的链接后添加
?download=1
,这样你的html应该像

<link href="http://copy.com/Kgs8EaMF71Qa7zqo/style.css?download=1" rel="stylesheet" type="text/css" />


还有其他几种云服务,例如,您可以在其中托管外部CSS文件。

如何检查该文件是否作为text/plainopen Firebug提供(如果未安装,请将其作为插件)。重新加载页面并检查网络部分中的“响应标题”。它可以在其他浏览器上工作,但在Mozilla Firefox上有问题