我有两个文件index.php和css文件.index.php工作正常,budcss为什么不工作


i have 2 files index.php and css files. index.php is worked correctly bud css is not working why?

我的索引是:

<html>
<head>
  <meta charset="utf-8"
  <link href="style.css" rel="stylesheet" />
  <title>collapaing Header</title>
</head>
<body>
<div id="container">
  <header>
    <h1>This is my header </h1>
  </header>
  <div id="banner">
    <h2> This is the banner </h2>
  </div>
  <div id="content">
    <p>Content goes here </p>
  </div>
  </body>
  </html>

我的css是:

body{
  text-align: center;
}
header{
  height: 100px;
  background: #dbdbdb;
  width: 100%;
  z-index: 10;
}
.banner{
  width: 100%;
  height: 500px;
  position: fixed;
  top: 100px;
  background: #707070;
}
.content{
  width: 100%;
  position: relative;
  top: 400px;
  height: 1500px;
}
  1. 当我测试的时候,你的CSS正在工作
  2. 您的元标记需要结束/>,现在它没有正确关闭
  3. 2号应该可以解决您的问题,如果没有,请确保style.cssindex.php在同一目录中

首先关闭meta标签,和尝试不自行关闭链接标签,检查css文件是否与html文件

在同一文件夹中