Let's quickly create a single login and registration form in html and css
In case you want to go into gradual details
.
The video I use as a background I found on pixabay you can use someone of your choice.
index.html
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<video poster="screenshot.jpg" autoplay playsinline muted loop>
<source src="thecity.mp4" type="video/mp4">
</video>
<div class="video">
<div class="form">
<div class="button">
<div id="btn"></div>
<button type="button" class="toggle-btn" onclick="loginform()">Log In</button>
<button type="button" class="toggle-btn" onclick="signupform()">Sign Up</button>
</div>
<form id="loginform" class="input-group">
<input type="text" class="input-field" placeholder="Username" required />
<input type="password" class="input-field" placeholder="Password" required />
<p class="Fpass"><a href="/">Forgot Password</a></p>
<button type="submit" class="submit-btn">Log In</button>
</form>
<form id="signupform" class="input-group">
<input type="text" class="input-field" placeholder="Username" required />
<input type="email" class="input-field" placeholder="E-mail" required />
<input type="password" class="input-field" placeholder="Password" required />
<button type="submit" class="submit-btn">Sign Up</button>
</form>
</div>
</div>
<script>
</script>
</body>
Javascript
<script>
var x = document.getElementById("loginform");
var y = document.getElementById("signupform");
var z = document.getElementById("btn");
function signupform() {
x.style.left = "-400px";
y.style.left = "50px";
z.style.left = "110px";
}
function loginform() {
x.style.left = "50px";
y.style.left = "450px";
z.style.left = "0";
}
</script>
Style.css
* {
margin: 0;
padding: 0;
font-family: sans-serif;
}
video { /* video background before known as a hero*/
width: 100vw;
height: 100vh;
object-fit: cover;
position: fixed;
top: 0;
left: 0;
z-index: -1;
}
.form { /* invisible form here settings*/
width: 380px;
height: 480px;
position: relative;
margin: 6% auto;
background: rgba(255, 255, 255, 0.062);
padding: 5px;
overflow: hidden;
}
.button {
width: 220px;
margin: 35px auto;
position: relative;
border-radius: 30px;
}
.toggle-btn {
padding: 10px 30px;
cursor: pointer;
background: transparent;
border: 0;
outline: none;
position: relative;
}
#btn {
top: 0;
left: 0;
position: absolute;
width: 100px;
height: 100%;
background: linear-gradient(to right, #10b3ff, #06ffc9);
border-radius: 0px;
transition: .5s;
}
.input-group {
top: 180px;
position: absolute;
width: 280px;
transition: .5s;
}
.input-field {
width: 100%;
padding: 10px 0;
margin: 5px 0;
border-left: 0;
border-top: 0;
border-right: 0;
border-bottom: 1px solid rgb(255, 255, 255);
outline: none;
background: transparent;
}
input, select, textarea {
color: rgb(255, 255, 255);
}
::placeholder { /* Placeholder text color*/
color: rgb(255, 255, 255);
opacity: 1;
}
.submit-btn {
width: 65%;
cursor: pointer;
display: block;
margin: 50;
background: transparent;
border-radius: 80px;
height: 40px;
line-height: 40px;
padding: 0 10px;
color: white;
border: solid 1px;
border-image: linear-gradient(to left, #10b3ff, #06ffc9);
border-image-slice: 1;
clip-path: polygon(0 0, 12px 0, 12px 1px, 24px 1px, 24px 0, 100% 0, 100% 100%, 0 100%);
}
span {
color: rgb(255, 255, 255);
font-size: 12px;
bottom: 68px;
position: absolute;
}
#loginform {
left: 50px;
}
#signupform {
left: 450px;
}
.Fpass a {
position:relative;
text-decoration: none;
color: rgb(42, 214, 214);
transition:color .15s ease-in-out;
top: 10px;
}
.Fpass a:hover {
background-size: 100% 100%;
cursor: pointer;
}
.Fpass a:after {
display:block;
content:"";
position: absolute;
right:0;
left:0;
width:100%;
height:3px;
opacity:0;
transform:translateY(-150%);
transition:transform .15s ease-in-out, opacity .15s ease-in-out;
background-color: rgba(0, 247, 255, 0.589);
}
.Fpass a.is-active,
.Fpass a:active,
.Fpass a:focus,
.Fpass a:hover {
color: rgba(0, 247, 255, 0.589);
}
.Fpass a.is-active:after,
.Fpass a:active:after,
.Fpass a:focus:after,
.Fpass a:hover:after {
transform:translateY(0);
opacity:1;
}
Top comments (0)