这是我的 html:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv = "Content-Language" content = "en"/>
<meta http-equiv = "Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="/xxx/app/www/style.css">
现在,当我加载页面时,Safari 的检查器会给我:
Resource interpreted as stylesheet but transferred with MIME type text/html
我正在使用 MAMP 在本地主机上工作。我不确定要修改什么才能让它工作。我读到这可能是某种服务器问题。
如何解决?
最佳答案
在您的根文件夹中创建一个 .htaccess
文件(或更新现有的文件),其中包含此行
AddType text/css .css
这将告诉 apache 为 .css
文件发送正确的 content-type
header
关于css - 资源解释为样式表但使用 MIME 类型 text/html 传输,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10553638/