我正在开发一个项目,但上线时我的 css 样式没有出现。我已将其链接到我的 html,但是当我在线时,样式仍然不会出现在浏览器上
我已经检查了网页本身,CSS也在那里,但我似乎无法找出问题所在
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> Mind Connect </title>
<link rel="stylesheet" href="css/styles.css">
*{
margin: 0px;
padding: 0px;
box-sizing: border-box;
font-family: poppins;
}
a{
text-decoration: none;
}
ul{
list-style: none;
}
#hero{
background-color: #f5f7fb;
display: flex;
flex-direction: column;
min-height: 600px;
}
.navigation{
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1200px;
width: 90%;
margin: 0px auto;
padding: 30px 0px;
您的
href
属性正在使用相对于 HTML 文件的路径。 css
文件夹是否位于您提供公共资产的文件夹中,通常称为 assets
或 public
?如果是这样,要正确引用文件,href 必须以斜杠开头,因此 /css/styles.css
。
(我本来想写一条评论,但我还没有足够的声誉。)