2017-01-01 56 views
0

你好,我刚开始学习HTML和CSS。我的CSS文件昨天晚上工作得很好,我能够应用我想要的任何更改,但现在我甚至无法更改HTML文件中任何元素的背景颜色或字体。请帮帮我。我试图让身体颜色变黑,但没有任何变化。 enter image description here为什么我的CSS现在不能工作,昨晚它工作得很好

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> \t 
 
     <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> 
+0

检查您的控制台是否有任何错误? – Ahmar

+0

@Ahmar css不会抛出错误 – Dummy

+0

我没有得到任何错误。 ( –

回答

1

一个显而易见的答案,将清除缓存或者只是做CTRL+F5。如果您不清楚如何清除缓存,请查看本网站。

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

+0

这个工作。愚蠢,谢谢! –

+0

哈哈,很高兴听到。浏览器缓存有时可能是开发者最糟糕的噩梦。 –

相关问题