html - 为什么我的 CSS 现在不工作了,昨晚它工作得很好

标签 html css

我的 CSS 文件昨晚工作得非常好,我可以应用我想要的任何更改,但现在我什至无法更改 HTML 文件中任何元素的背景颜色或字体。请帮我。例如,我尝试将主体颜色设为黑色,但没有任何改变。 enter image description here

HTML 和 CSS

body {
  margin: 60px;
  margin-left: 150px;
  margin-right: 150px;
  font-family: Avantgarde, sans-serif;
  background: black;
}
header {
  background: gray;
  font-size: 2.0em;
  padding: 10px;
  color: white;
  text-align: center;
}
h2 {
  font-size: 20px;
}
#container {
  box-sizing: border-box;
  width: 100%;
  border: 0.5px solid gray;
  padding: 25px;
  clear: both;
  display: table;
}
input {
  font-size: 15px;
  display: inline-block;
  clear: left;
  width: 150px;
  text-align: left;
}
label {
  font-size: 15px;
  display: inline-block;
  clear: left;
  width: 150px;
  text-align: left;
}
#submit {
  font-size: 20px;
  text-align: center;
  display: inline-block;
  clear: left;
  width: 200px;
}
#login {
  border: 1px solid gray;
  padding: 20px;
  padding-left: 40px;
}
#register {
  border: 1px solid gray;
  padding: 20px;
  padding-left: 40px;
}
<header>
  Employee Management System
</header>
<div id="container">
  <div id="login">
    <form action="login.php" method="POST">
      <h2>Fill out this form if you have an existing account</h2>
      <label>Username:</label>
      <input type="text" id="username" name="username" placeholder="your username" required/>
      <br>
      <label>Password:</label>
      <input type="text" id="password" name="password" placeholder="password" required/>
      <br>
      <label></label>
      <input type="submit" value="Login" />
    </form>
  </div>
  <br>
  <div id="register">
    <form method="POST" action="register.php" class="form" onsubmit="return submitform(this)" id="myForm">
      <h2>Register Account</h2>	
      <label>First Name:</label>
      <input type="text" id="fname" name="fname" placeholder="your first name" required/>
      <br>
      <label>Last Name:</label>
      <input type="text" id="lname" name="lname" placeholder="your last name" required/>
      <br>
      <label>Username:</label>
      <input type="text" id="username" name="username" placeholder="your username" required/>
      <br>
      <label>Password:</label>
      <input type="text" id="password" name="password" placeholder="password" required/>
      <br>
      <label>Confirm Password:</label>
      <input type="text" id="cpassword" name="cpassword" placeholder="password" required/>
      <br>
      <br>
      <span class="error"></span> 
      <br>
      <br>
      <label></label>
      <input type="submit" value="Register" class="submit" />
    </form>
  </div>
</div>

头部部分看起来像这样:

<!DOCTYPE html>
<html>
    <head>
        <title>Employee Management System</title>   
        <link href="style.css" rel="stylesheet" type="text/css"/>
    </head>

最佳答案

一个明显的答案是清除您的缓存或只执行 CTRL+F5。如果您不太确定如何清除缓存,请查看此站点。

http://www.refreshyourcache.com/en/home

关于html - 为什么我的 CSS 现在不工作了,昨晚它工作得很好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41417587/

相关文章:

javascript - Bootstrap 模式对话框中的验证

html - Bootstrap 3 嵌套行宽

php - Ajax 投票民意调查直接工作,但不是通过第二个 ajax 调用

html - 如何在浏览器中显示 <tag>?

javascript - 在scrollTop 中使用时,jQuery animate() 在 margin-left 上无法正常工作

javascript - jQuery:仅当第一个(:第一个)TD 不包含文本(:empty)时,才为所有空的子 TD 设置样式

html - 在表单中包含额外的 HTTPS 请求 header 信息

html - div中的全 Angular 输入

php - 如何在我的 Wordpress 博客中找到 customize.php 加载的 css 样式的来源?

css - 当两个子 div 并排时居中包装 div