h5简单的登录注册页面
时间: 2024-02-05 14:11:07 浏览: 140
以下是一个基本的HTML和CSS代码示例,包括一个简单的登录和注册表单:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>Login and Register</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<div class="form-container sign-up-container">
<form action="#">
<h1>Create Account</h1>
<input type="text" placeholder="Name">
<input type="email" placeholder="Email">
<input type="password" placeholder="Password">
<button>Sign Up</button>
</form>
</div>
<div class="form-container sign-in-container">
<form action="#">
<h1>Sign in</h1>
<input type="email" placeholder="Email">
<input type="password" placeholder="Password">
<a href="#">Forgot your password?</a>
<button>Sign In</button>
</form>
</div>
<div class="overlay-container">
<div class="overlay">
<div class="overlay-panel overlay-left">
<h1>Welcome Back!</h1>
<p>To keep connected with us please login with your personal info</p>
<button class="ghost" id="signIn">Sign In</button>
</div>
<div class="overlay-panel overlay-right">
<h1>Hello, Friend!</h1>
<p>Enter your personal details and start journey with us</p>
<button class="ghost" id="signUp">Sign Up</button>
</div>
</div>
</div>
</div>
<script src="main.js"></script>
</body>
</html>
```
CSS代码:
```
* {
box-sizing: border-box;
}
body {
background: #f1f1f1;
font-family: Arial, Helvetica, sans-serif;
}
.container {
background: #fff;
border-radius: 10px;
box-shadow: 0 14px 28px rgba(0,0,0,0.25),
0 10px 10px rgba(0,0,0,0.22);
position: relative;
overflow: hidden;
width: 768px;
max-width: 100%;
min-height: 480px;
}
.form-container {
position: absolute;
top: 0;
height: 100%;
transition: all 0.6s ease-in-out;
}
.sign-in-container {
left: 0;
width: 50%;
z-index: 2;
}
.sign-up-container {
left: 0;
width: 50%;
opacity: 0;
z-index: 1;
}
.overlay-container {
position: absolute;
top: 0;
left: 50%;
width: 50%;
height: 100%;
overflow: hidden;
transition: transform 0.6s ease-in-out;
z-index: 100;
}
.overlay {
background: #FF416C;
background: -webkit-linear-gradient(to right, #FF4B2B, #FF416C);
background: linear-gradient(to right, #FF4B2B, #FF416C);
background-repeat: no-repeat;
background-size: cover;
background-position: 0 0;
color: #FFFFFF;
position: relative;
left: -100%;
height: 100%;
width: 200%;
transform: translateX(0);
transition: transform 0.6s ease-in-out;
}
.overlay-panel {
position: absolute;
top: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
padding: 0 40px;
height: 100%;
width: 50%;
text-align: center;
transform: translateX(0);
transition: transform 0.6s ease-in-out;
}
.overlay-left {
transform: translateX(-20%);
}
.overlay-right {
right: 0;
transform: translateX(0);
}
.container.right-panel-active .sign-in-container {
transform: translateX(100%);
}
.container.right-panel-active .sign-up-container {
transform: translateX(100%);
opacity: 1;
z-index: 5;
animation: show 0.6s;
}
@keyframes show {
0%, 49.99% {
z-index: 1;
}
50%, 100% {
z-index: 5;
}
}
.form-container h1 {
font-weight: bold;
margin: 0;
}
.form-container input {
background-color: #fff;
border: none;
padding: 12px 15px;
margin: 8px 0;
width: 100%;
}
.form-container button {
background-color: #FF416C;
color: #FFFFFF;
border: none;
padding: 12px 20px;
cursor: pointer;
border-radius: 20px;
margin: 10px 0;
width: 100%;
}
.form-container button:focus {
outline: none;
}
.ghost {
background-color: transparent;
border-color: #FFFFFF;
color: #FFFFFF;
}
.ghost:hover {
background-color: #FFFFFF;
color: #FF416C;
}
a {
color: #FFFFFF;
font-size: 14px;
text-decoration: none;
margin: 15px 0;
}
.container:before {
content: "";
background-color: #FFFFFF;
border-radius: 50%;
height: 1400px;
left: -700px;
bottom: -650px;
position: absolute;
transform: rotate(45deg);
width: 1400px;
}
```
这是一个简单的登录和注册页面,其中包括一个切换效果。当用户点击“注册”按钮时,右侧面板滑入视图,并显示注册表单。当用户点击“登录”按钮时,反之亦然。
阅读全文