你好,我剛開始學習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>
檢查您的控制檯是否有任何錯誤? – Ahmar
@Ahmar css不會拋出錯誤 – Dummy
我沒有得到任何錯誤。 ( –