链接css文件时出现mime错误/css样式无效
我在这里有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
<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') %>