编写一个非常漂亮的用户登录页面
时间: 2024-02-03 14:02:05 浏览: 32
很高兴为您提供帮助!以下是一个简单的用户登录页面示例,您可以根据自己的需要进行修改和定制。
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>用户登录</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #f1f1f1;
}
* {
box-sizing: border-box;
}
/* Add padding to containers */
.container {
padding: 16px;
background-color: #fff;
}
/* Full-width input fields */
input[type=text], input[type=password] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
display: inline-block;
border: none;
background: #f1f1f1;
}
input[type=text]:focus, input[type=password]:focus {
background-color: #ddd;
outline: none;
}
/* Overwrite default styles of hr */
hr {
border: 1px solid #f1f1f1;
margin-bottom: 25px;
}
/* Set a style for the submit button */
.loginbtn {
background-color: #4CAF50;
color: white;
padding: 16px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
opacity: 0.9;
}
.loginbtn:hover {
opacity:1;
}
/* Add a blue text color to links */
a {
color: dodgerblue;
}
/* Set a grey background color and center the text of the "sign in" section */
.signin {
background-color: #f1f1f1;
text-align: center;
}
</style>
</head>
<body>
<h2>用户登录</h2>
<form action="/action_page.php">
<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>
<hr>
<button type="submit" class="loginbtn">登录</button>
</div>
<div class="container signin">
<p>没有账号? <a href="#">立即注册</a>.</p>
</div>
</form>
</body>
</html>
```
这是一个简单的HTML代码,只需要在浏览器中打开即可查看效果。你也可以将其保存为login.html,然后直接在浏览器中打开。
该页面包括一个标题、两个输入框(用于输入用户名和密码)、一个登录按钮和一个注册链接。CSS样式使页面看起来更加美观和专业。