Login/Registration form
using SCSS !
by Bianca Kuehweidner
HTML
<p class="tip">Click on button in image container</p>
<div class="cont">
<div class="form sign-in">
<h2>Welcome back,</h2>
<label>
<span>Email</span>
<input type="email" />
</label>
<label>
<span>Password</span>
<input type="password" />
</label>
<p class="forgot-pass">Forgot password?</p>
<button type="button" class="submit">Sign In</button>
<button type="button" class="fb-btn">Connect with <span>facebook</span></button>
</div>
<div class="sub-cont">
<div class="img">
<div class="img__text m--up">
<h2>New here?</h2>
<p>Sign up and discover great amount of new opportunities!</p>
</div>
<div class="img__text m--in">
<h2>One of us?</h2>
<p>If you already has an account, just sign in. We've missed you!</p>
</div>
<div class="img__btn">
<span class="m--up">Sign Up</span>
<span class="m--in">Sign In</span>
</div>
</div>
<div class="form sign-up">
<h2>Time to feel like home,</h2>
<label>
<span>Name</span>
<input type="text" />
</label>
<label>
<span>Email</span>
<input type="email" />
</label>
<label>
<span>Password</span>
<input type="password" />
</label>
<button type="button" class="submit">Sign Up</button>
<button type="button" class="fb-btn">Join with <span>facebook</span></button>
</div>
</div>
</div>
<a href="https://dribbble.com/shots/3306190-Login-Registration-form" target="_blank" class="icon-link">
<img src="http://icons.iconarchive.com/icons/uiconstock/socialmedia/256/Dribbble-icon.png">
</a>
<a href="https://twitter.com/NikolayTalanov" target="_blank" class="icon-link icon-link--twitter">
<img src="https://cdn1.iconfinder.com/data/icons/logotypes/32/twitter-128.png">
</a>
SCSS
*, *:before, *:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
background: #ededed;
}
input, button {
border: none;
outline: none;
background: none;
font-family: 'Open Sans', Helvetica, Arial, sans-serif;
}
$contW: 900px;
$imgW: 260px;
$formW: $contW - $imgW;
$switchAT: 1.2s;
$inputW: 260px;
$btnH: 36px;
$diffRatio: ($contW - $imgW) / $contW;
@mixin signUpActive {
.cont.s--signup & {
@content;
}
}
.tip {
font-size: 20px;
margin: 40px auto 50px;
text-align: center;
}
.cont {
overflow: hidden;
position: relative;
width: $contW;
height: 550px;
margin: 0 auto 100px;
background: #fff;
}
.form {
position: relative;
width: $formW;
height: 100%;
transition: transform $switchAT ease-in-out;
padding: 50px 30px 0;
}
.sub-cont {
overflow: hidden;
position: absolute;
left: $formW;
top: 0;
width: $contW;
height: 100%;
padding-left: $imgW;
background: #fff;
transition: transform $switchAT ease-in-out;
@include signUpActive {
transform: translate3d($formW * -1,0,0);
}
}
button {
display: block;
margin: 0 auto;
width: $inputW;
height: $btnH;
border-radius: 30px;
color: #fff;
font-size: 15px;
cursor: pointer;
}
.img {
overflow: hidden;
z-index: 2;
position: absolute;
left: 0;
top: 0;
width: $imgW;
height: 100%;
padding-top: 360px;
&:before {
content: '';
position: absolute;
right: 0;
top: 0;
width: $contW;
height: 100%;
background-image: url('https://s3-us-west-2.amazonaws.com/s.cdpn.io/142996/sections-3.jpg');
background-size: cover;
transition: transform $switchAT ease-in-out;
}
&:after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.6);
}
@include signUpActive {
&:before {
transform: translate3d($formW,0,0);
}
}
&__text {
z-index:...
JavaScript
document.querySelector('.img__btn').addEventListener('click', function() {
document.querySelector('.cont').classList.toggle('s--signup');
});