Features
- Smooth sliding animation between Login and Register
- Fully responsive on mobile and desktop.
- Clean UI inspired by modern web design trends
- Uses vanilla JS for simplicity
* {
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #f6f5f7;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.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 {
left: 0;
width: 50%;
z-index: 2;
}
.sign-up {
left: 0;
width: 50%;
opacity: 0;
z-index: 1;
}
.container.right-panel-active .sign-in {
transform: translateX(100%);
}
.container.right-panel-active .sign-up {
transform: translateX(100%);
opacity: 1;
z-index: 5;
}
form {
background: #ffffff;
display: flex;
flex-direction: column;
padding: 0 50px;
height: 100%;
justify-content: center;
align-items: center;
text-align: center;
}
input {
background: #eee;
border: none;
padding: 12px 15px;
margin: 8px 0;
width: 100%;
}
button {
border-radius: 20px;
border: 1px solid #ff4b2b;
background: #ff4b2b;
color: #ffffff;
font-size: 12px;
padding: 10px 40px;
letter-spacing: 1px;
text-transform: uppercase;
transition: transform 80ms ease-in;
cursor: pointer;
margin-top: 10px;
}
button:hover {
background-color: #e94e2d;
}
button:active {
transform: scale(0.95);
}
button:focus {
outline: none;
}
hr {
border: none;
height: 1px;
background: #eee;
margin: 20px 0;
}
.toggle-container {
position: absolute;
top: 0;
left: 50%;
width: 50%;
height: 100%;
overflow: hidden;
transition: transform 0.6s ease-in-out;
z-index: 1000;
}
.container.right-panel-active .toggle-container {
transform: translateX(-100%);
}
.toggle {
background: #ff4b2b;
height: 100%;
color: #fff;
position: relative;
left: -100%;
height: 100%;
width: 200%;
transform: translateX(0);
transition: transform 0.6s ease-in-out;
}
.container.right-panel-active .toggle {
transform: translateX(50%);
}
.toggle-panel {
position: absolute;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 40px;
text-align: center;
top: 0;
height: 100%;
width: 50%;
transform: translateX(0);
transition: all 0.6s ease-in-out;
}
.toggle-left {
transform: translateX(-200%);
}
.container.right-panel-active .toggle-left {
transform: translateX(0);
}
.toggle-right {
right: 0;
transform: translateX(0);
}
.container.right-panel-active .toggle-right {
transform: translateX(200%);
}
@media (max-width: 768px) {
.container {
width: 100vw;
min-height: 100vh;
}
.form-container {
width: 100%;
}
.toggle-container {
display: none;
}
}
const container = document.getElementById("container");
function toggleForms() {
container.classList.toggle("right-panel-active");
}
Post a Comment
Thank you
Learning robo team