【问题标题】:i have 2 files index.php and css files. index.php is worked correctly bud css is not working why? [closed]我有 2 个文件 index.php 和 css 文件。 index.php 工作正常,但 css 不能正常工作,为什么? [关闭]
【发布时间】:2016-04-03 15:13:04
【问题描述】:

我的索引是:

<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;
}

【问题讨论】:

  • 真的吗?你把每个字符串都放在`?
  • “不工作” - 我们真的不知道应该如何工作......所以,描述问题。
  • 我的 CSS 不工作 apply nothing
  • 可能是因为这一行没有正确结束:
  • @bas schreuder tanq 发表评论,但不是

标签: php html css indexing


【解决方案1】:
  1. 当我测试时,您的 CSS 工作正常。
  2. 您的元标记需要以/&gt; 结尾,现在它没有正确关闭。
  3. 2 号应该可以解决您的问题,如果没有,请确保 style.cssindex.php 位于同一目录中。

【讨论】:

    【解决方案2】:

    首先,关闭元标记, 和 尽量不要自行关闭链接标签, 检查css文件是否与html文件在同一文件夹中

    【讨论】:

    • tanq 回答但仍然不行
    • 尝试在html代码顶部添加doctype html标签
    • 或者尝试使用内部css在head标签中使用style标签
    猜你喜欢
    • 1970-01-01
    • 2019-08-29
    • 2014-09-28
    • 1970-01-01
    • 2016-03-06
    • 2021-06-11
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多