login页面设计代码
时间: 2023-10-19 09:14:35 浏览: 108
以下是一个简单的 login 页面设计代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
}
.container {
background-color: #fff;
border-radius: 5px;
box-shadow: 0px 0px 10px #aaa;
padding: 20px;
margin: 20px auto;
max-width: 400px;
}
h1 {
text-align: center;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
width: 100%;
}
button:hover {
background-color: #45a049;
}
.cancelbtn {
background-color: #f44336;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
position: relative;
}
img.avatar {
width: 100px;
height: 100px;
border-radius: 50%;
}
.container label {
color: #666;
}
.container span.psw {
float: right;
padding-top: 16px;
}
@media screen and (max-width: 600px) {
.container {
max-width: 300px;
}
input[type=text], input[type=password] {
width: 100%;
padding: 10px 18px;
}
button {
padding: 10px 18px;
}
}
</style>
</head>
<body>
<div class="container">
<h1>Login</h1>
<form action="/action_page.php">
<div class="imgcontainer">
<img src="avatar.png" alt="Avatar" class="avatar">
</div>
<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" class="cancelbtn">Cancel</button>
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</form>
</div>
</body>
</html>
```
这个代码包含了一个带有用户名、密码、记住我选项和登录按钮的表单,以及一个忘记密码链接和取消按钮。可以将它保存为 .html 文件并在浏览器中打开,以查看它的外观和功能。
阅读全文