Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/34.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/2/node.js/42.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
链接css文件时出现mime错误/css样式无效_Css_Node.js_Express - Fatal编程技术网

链接css文件时出现mime错误/css样式无效

链接css文件时出现mime错误/css样式无效,css,node.js,express,Css,Node.js,Express,我在这里有css链接: <link rel="stylesheet" type="text/html" href="/public/assets/lib/css/style.css" /> 标题: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=devic

我在这里有css链接:

<link rel="stylesheet" type="text/html" href="/public/assets/lib/css/style.css" />
标题:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />

*


*


电视指南
搜索:

<%- include('partials/header') %>
<section class="container-fluid content">
  <nav class="navbar navbar-light bg-light">
    <a class="navbar-brand" href="#">
      <i class="fas fa-tape">filmraid</i>
    </a>
  </nav>

  <h1>Search for a Movie</h1>

  <form action="results" method="GET">
    <input type="text" placeholder="search term" name="search" />
    <!-- <br />
  <input type="radio" id="usMovies" name="location" /> US
  <input type="radio" id="ukMovies" name="location" /> UK -->
    <br />
    <input type="submit" />
  </form>
</section>
<%- include('partials/footer') %>

搜索电影

我想知道我是否遗漏了什么。
感谢您查看。

通过以下方式解决了此问题:

  • 正在创建新的公用文件夹,因为


无法访问。

您正在css文件上使用
type=“text/html”
。。改为使用
text/css
。@SaurabhSharma如上文所述,文本/css会导致mime错误更改
app.use(express.static(uu dirname+/public))
应用程序使用(express.static(uu dirname+'public')
并将
href=“/public/assets/lib/css/style.css”
更改为
href=“/assets/lib/css/style.css”
@SaurabhSharma这些样式仍然不适用不确定原因。我本来也有这个。
    <link rel="stylesheet" type="text/html" href="/public/assets/lib/css/style.css" />
    <link
      rel="stylesheet"
      href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap"
    />
    <link
      href="https://fonts.googleapis.com/css?family=Josefin+Sans:600|Open+Sans&display=swap"
      rel="stylesheet"
    />
    <link
      rel="stylesheet"
      href="https://fonts.googleapis.com/icon?family=Material+Icons"
    />
    <link
      rel="stylesheet"
      href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
      integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
      crossorigin="anonymous"
    />
    <script
      src="https://kit.fontawesome.com/3870ba704e.js"
      crossorigin="anonymous"
    ></script>
    <title>tv guide</title>
  </head>
  <body>
<%- include('partials/header') %>
<section class="container-fluid content">
  <nav class="navbar navbar-light bg-light">
    <a class="navbar-brand" href="#">
      <i class="fas fa-tape">filmraid</i>
    </a>
  </nav>

  <h1>Search for a Movie</h1>

  <form action="results" method="GET">
    <input type="text" placeholder="search term" name="search" />
    <!-- <br />
  <input type="radio" id="usMovies" name="location" /> US
  <input type="radio" id="ukMovies" name="location" /> UK -->
    <br />
    <input type="submit" />
  </form>
</section>
<%- include('partials/footer') %>