用html写一个登录界面
时间: 2023-05-27 10:04:33 浏览: 42
<!DOCTYPE html>
<html>
<head>
<title>登录界面</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
/* 设置页面样式 */
body {
font-family: Arial, Helvetica, sans-serif;
}
/* 设置表单样式 */
form {
border: 3px solid #f1f1f1;
margin-top: 50px;
margin-left: 500px;
margin-right: 500px;
padding: 20px;
}
/* 自定义输入框样式 */
input[type=text],
input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
/* 设置按钮样式 */
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
/* 设置按钮hover样式 */
button:hover {
opacity: 0.8;
}
/* 设置取消按钮样式 */
.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}
/* 设置容器样式 */
.container {
padding: 16px;
}
/* 清除浮动 */
.clearfix::after {
content: "";
clear: both;
display: table;
}
/* 设置登录界面标题样式 */
.title {
text-align: center;
font-size: 36px;
}
</style>
</head>
<body>
<form action="" method="post">
<div class="title">
<h2>登录界面</h2>
</div>
<div class="container">
<label for="uname"><b>用户名</b></label>
<input type="text" placeholder="请输入用户名" name="uname" required>
<label for="psw"><b>密码</b></label>
<input type="password" placeholder="请输入密码" name="psw" required>
<div class="clearfix">
<button type="submit" class="loginbtn">登录</button>
<button type="button" class="cancelbtn">取消</button>
</div>
</div>
</form>
</body>
</html>