我收到一条错误消息,提示它无法添加我的样式表,因为它是 mime 类型。我怀疑这与我给它的路径有关但不完全确定
我尝试更改文件路径并通过单击 visual studio 代码中的链接将我带到 css 样式表,但不在我的本地主机上。
Error
Refused to apply style from 'http://localhost:8081/assets/css/stylesheet.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled
Link Source
<link rel="stylesheet" href="assets/css/stylesheet.css">
File System
public|-
assets|-
css|-
-stylesheet.css
index.html
server.js
最佳答案
尝试在链接标签中添加type="text/css"
。
关于html - 样式表未应用于 html,因为它是 mime 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58173710/