【问题标题】:Why is my CSS not working now, it was working perfectly fine last night为什么我的 CSS 现在不工作了,昨晚工作得很好
【发布时间】:2017-05-16 00:21:42
【问题描述】:

昨晚我的 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>

【问题讨论】:

  • 检查您的控制台是否有任何错误?
  • @Ahmar css 不会抛出错误
  • 我没有收到任何错误。而且我显然多次刷新了我的页面,但没有任何效果.. :(
  • 未刷新,但您是否清除了缓存并刷新/CTRL+F5?
  • 我清除了浏览器的缓存,终于成功了。谢谢

标签: html css


【解决方案1】:

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

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

【讨论】:

  • 哈哈,很高兴听到。浏览器缓存有时可能是开发人员最糟糕的噩梦。
猜你喜欢
  • 2016-12-26
  • 2023-01-02
  • 2019-12-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-26
  • 1970-01-01
相关资源
最近更新 更多