html css 漂亮的登陆界面
时间: 2023-07-26 19:42:42 浏览: 46
好的,我可以为您提供一些 HTML 和 CSS 代码来创建漂亮的登录界面。以下是一个简单的示例:
HTML 代码:
```
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="login-box">
<h2>Login Here</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;
font-family: sans-serif;
background: linear-gradient(to right, #00C9FF, #92FE9D);
}
.login-box {
width: 320px;
height: 420px;
background: #000;
color: #fff;
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;
}
.user-box {
position: relative;
}
.user-box input {
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #fff;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #fff;
outline: none;
background: transparent;
}
.user-box label {
position: absolute;
top: 0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #fff;
pointer-events: none;
transition: 0.5s;
}
.user-box input:focus ~ label,
.user-box input:valid ~ label {
top: -20px;
left: 0;
color: #00bcd4;
font-size: 12px;
}
a {
text-decoration: none;
display: inline-block;
background: #00bcd4;
color: #fff;
padding: 10px 20px;
margin-top: 40px;
border-radius: 30px;
transition: 0.5s;
}
a:hover {
background: #fff;
color: #00bcd4;
}
```
该代码将创建一个黑色背景的登录框,其中包括一个标题、“用户名”和“密码”输入框以及一个提交按钮。您可以根据需要进行调整。