我无法建立HTML和CSS代码链接。 (是的,我已经查过,但仍然无法正常工作)
我的HTML代码
(名称: test1.html ,完整路径: /tacocraft.net/tacocraft.net/testing-and-stuff/test1.html / )
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type= "text/css" href="test1css.css" />
<body>
<h3>Please input username and password</h3>
<div>
<form action="/action_page.php">
<label for="fname">Username</label>
<input type="text" id="fname" name="firstname" placeholder="Username(Admin)">
<label for="lname">Password</label>
<input type="text" id="lname" name="lastname" placeholder="Password(Admin)">
<input type="submit" value="Submit">
</form>
</div>
</body>
</html>
和我的CSS(名称 test1css.css ,路径: /tacocraft.net/tacocraft.net/testing-and-stuff/test1css.css / ) >
input[type=text], select {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
input[type=submit] {
width: 100%;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type=submit]:hover {
background-color: #45a049;
}
div {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
答案 0 :(得分:5)
您缺少结束</head>
标记。
如果没有</head>
,它将无法正确链接,因为它会看到其余部分嵌套在头部。 CSS永远不会生效。