html - 样式表未应用于 html,因为它是 mime 类型

标签 html css express filesystems

我收到一条错误消息,提示它无法添加我的样式表,因为它是 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/

相关文章:

javascript - 为什么 isomorphic-style-loader 会抛出 TypeError : Cannot read property 'apply' of undefined when being used in unison with CSS-Modules

javascript - 直播到浏览器

java - LibGDX 删除 GWT 窗口填充

javascript - 使用 JavaScript 更改所有 <pre> 标签的内容

node.js - 带子路由器的 Express 路由器

node.js - 在 Express : userid not found 中使用 rest api

css - 如何在 div block 中直观地扩展 HTML 元素?

javascript - 检查script标签中的内容

html - CSS - 2列布局

css - 如何在动画结束时旋转图标?