用HTML和Css写一个登录页面
时间: 2024-05-05 07:16:54 浏览: 6
HTML是用来结构化网页内容的语言,而CSS是用来设计网页外观的语言。下面是一个简单的登录页面的例子:
```html
<!DOCTYPE html>
<html>
<head>
<title>登录页面</title>
<style>
/* CSS样式 */
.container {
width: 400px;
margin: 0 auto;
text-align: center;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"], input[type="password"] {
width: 200px;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
}
input[type="submit"] {
width: 100px;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border: none;
border-radius: 4px;
background-color: #4CAF50;
color: white;
}
</style>
</head>
<body>
<div class="container">
<form>
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<br>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<br><br>
<input type="submit" value="登录">
</form>
</div>
</body>
</html>
```
这个例子中,用户名和密码是必填项.