通过register.html来写login.html代码和改进s1.css代码
时间: 2024-03-10 16:46:39 浏览: 28
好的,以下是通过register.html来写login.html代码的示例代码:
login.html
```
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Login</title>
<link rel="stylesheet" href="s1.css">
</head>
<body>
<div class="login-box">
<h2>Login</h2>
<form>
<div class="user-box">
<input type="email" name="email" required>
<label>Email</label>
</div>
<div class="user-box">
<input type="password" name="password" required>
<label>Password</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Submit
</a>
<p class="signup-link">Don't have an account? <a href="register.html">Sign up</a></p>
</form>
</div>
</body>
</html>
```
在以上代码中,我们将用户名改为了邮箱,并且添加了“Don't have an account? Sign up”链接。
接着,这里是改进后的s1.css代码:
s1.css
```
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
}
body {
background: #1e272e;
}
.login-box {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 350px;
height: 500px;
padding: 80px 40px;
background: #fff;
border-radius: 10px;
}
.login-box h2 {
margin: 0 0 30px;
padding: 0;
color: #333;
text-align: center;
}
.login-box .user-box {
position: relative;
}
.login-box .user-box input {
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #333;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #777;
outline: none;
background: transparent;
}
.login-box .user-box label {
position: absolute;
top: 0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #777;
pointer-events: none;
transition: .5s;
}
.login-box .user-box input:focus ~ label,
.login-box .user-box input:valid ~ label {
top: -20px;
left: 0;
color: #333;
font-size: 12px;
}
.login-box a {
display: inline-block;
background: #1e272e;
color: #fff;
text-transform: uppercase;
font-size: 16px;
text-align: center;
padding: 14px 40px;
margin-top: 50px;
border-radius: 30px;
overflow: hidden;
position: relative;
}
.login-box a span {
position: absolute;
display: block;
background: #fff;
width: 20px;
height: 20px;
border-radius: 50%;
animation: a 1s linear infinite;
z-index: -1;
}
.login-box a span:nth-child(1) {
left: -25%;
top: -50%;
animation-delay: 0ms;
}
.login-box a span:nth-child(2) {
left: -25%;
top: 150%;
animation-delay: 500ms;
}
.login-box a span:nth-child(3) {
right: -25%;
top: -50%;
animation-delay: 1000ms;
}
.login-box a span:nth-child(4) {
right: -25%;
top: 150%;
animation-delay: 1500ms;
}
.login-box a:hover span {
animation: none;
}
.signup-link {
text-align: center;
margin-top: 20px;
}
.signup-link a {
color: #1e272e;
font-weight: bold;
text-decoration: none;
}
.signup-link a:hover {
text-decoration: underline;
}
```
在以上代码中,我们添加了一个“Don't have an account? Sign up”链接,并为其设置了样式。同时,我们将按钮的背景颜色与链接的文字颜色进行了调整,以提升整体的视觉效果。