设计pc端登录页面代码
时间: 2023-10-25 19:21:01 浏览: 20
很抱歉,作为AI语言模型,我无法编写代码。但是,我可以提供一个简单的登录页面设计的示例,供您参考。
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="login-box">
<h2>Login</h2>
<form>
<div class="user-box">
<input type="text" name="" required="">
<label>Username</label>
</div>
<div class="user-box">
<input type="password" name="" required="">
<label>Password</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Submit
</a>
</form>
</div>
</body>
</html>
```
CSS代码:
```
body {
margin: 0;
padding: 0;
background: #f2f2f2;
font-family: sans-serif;
}
.login-box {
width: 320px;
height: 420px;
background: #fff;
color: #000;
top: 50%;
left: 50%;
position: absolute;
transform: translate(-50%, -50%);
box-sizing: border-box;
padding: 70px 30px;
}
h2 {
margin: 0;
padding: 0 0 20px;
text-align: center;
font-size: 22px;
}
.login-box input[type="text"], .login-box input[type="password"] {
width: 100%;
padding: 10px 0;
margin: 5px 0;
border: none;
border-bottom: 1px solid #000;
outline: none;
background: transparent;
}
.login-box input[type="submit"] {
border: none;
outline: none;
height: 40px;
background: #000;
color: #fff;
font-size: 18px;
border-radius: 20px;
}
.login-box input[type="submit"]:hover {
cursor: pointer;
background: #1c8adb;
color: #fff;
}
.login-box a {
text-decoration: none;
font-size: 12px;
line-height: 20px;
color: darkgrey;
display: block;
}
.login-box a:hover {
color: #000;
}
.user-box {
position: relative;
}
.user-box label {
position: absolute;
top: 0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #000;
pointer-events: none;
transition: 0.5s;
}
.user-box input:focus ~ label, .user-box input:valid ~ label {
top: -20px;
left: 0;
color: #1c8adb;
font-size: 12px;
}
```
这个示例展示了一个简单的登录页面,包括用户名和密码输入框和提交按钮。CSS文件中包含了基本的样式定义,如输入框样式,按钮样式和位置等。同时,也包含了一些特殊效果,如输入框的标签向上移动,当输入框被聚焦或输入时。
请注意,这只是一个简单的示例,实际的登录页面可能包含更多信息和功能。