Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <html>

<head>

  <link href="https://fonts.googleapis.com/css?family=Karla:400,700|Space+Mono:400,400i,700,700i" rel="stylesheet">
  <!-- <meta name="viewport" content="width=device-width, initial-scale=0.41, maximum-scale=1" /> -->

  <meta charset="UTF-8">
  <title>Login/Sign-Up Form - By MuhammadJ</title>
</head>

<body>
  <section id="wrapper">

    <div id="one">
      <form>
        <label for="fName">Full name</label>
        <p><input type="text" id="fName" autocomplete="off" /></p>

        <label for="email">Email</label>
        <p><input type="email" id="email" placeholder="Enter valid email" autocomplete="off" /></p>

        <label for="password">Password</label>
        <p><input type="password" id="password" placeholder="8 characters minimum" /></p>


        <p class="submit"><input type="submit" value="Sign up" /></p>
      </form>
    </div>

    <div id="two">
      <form>

        <label for="emailIn">Email</label>
        <p><input type="email" id="emailIn" placeholder="Enter valid email" autocomplete="off" /></p>

        <label for="passwordIn">Password</label>
        <p><input type="password" id="passwordIn" placeholder="8 characters minimum" /></p>
        <p class="submit"><input type="submit" value="Sign In" /></p>

      </form>
    </div>
    <div id="button">Sign In </div>
  </section>


</body>

</html>
              
            
!

CSS

              
                body {
  margin: 0;
  
}

html {
  width: 100%;
  padding:20px;
  background: linear-gradient(to left, #ddd6f3, #faaca8);
  display: flex;
  justify-content: center;
  align-items: center;
  
}

*,
*:before,
*:after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  font-family: 'Space Mono', monospace;
}

::selection {
  background: #FDED62;
  color: #3C2FA4;
}

#wrapper {
  position: relative;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
  background: #3C2FA4;
  width: 400px;
  height: 500px;
  overflow: hidden;
}

#one {
  position: absolute;
  width: 400px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 50px;
  opacity: 1;
  transition: all 0.5s cubic-bezier(0.86, 0, 0.07, 1);
}

#two {
  position: absolute;
  top: 0;
  left: 0;
  width: 400px;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 50px;
  transform: translateX(-100%);
  transition: all 0.5s cubic-bezier(0.86, 0, 0.07, 1);
}

input {
  font-family: 'Space Mono', monospace;
  font-size: 1em;
  font-weight: 700;
  outline: 0;
  padding-left: 10px;
  width: 100%;
  height: 30px;
  color: #FDED62;
  background: #3C2FA4;
  border: 1px solid #fff;
  transition: all 0.3s ease, transform 0.15s ease;
}

input:focus {
  border-color: #FDED62;
  background: #FDED62;
  color: #4133B4;
}

label {
  width: 100%;
  font-family: 'Karla', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  position: relative;
  color: #fff;
  font-size: 13px;
  transition: all 0.2s ease
}

input:hover,
label:hover {
  cursor: pointer;
}

p {
  position: relative;
  margin: 0 0 10px 0;
  padding: 0;
  z-index: 1;
}

p:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background: #fb6868;
  transform: translate(5px, 5px);
  transition: all 0.33s ease;
}

p:not(.submit):hover::before {
  background: #fff;
}

::-webkit-input-placeholder {
  font-size: 0.8em;
  color: #3C2FA4;
  opacity: 0.5;
}

input[type="submit"] {
  color: #3C2FA4;
  border: none;
  background: #fff;
  font-style: italic;
  font-weight: 400;
  transition: all 0.33s ease;
}

input[type="submit"]:hover {}

p.submit {
  margin-top: 25px;
  transform: translateX(0);
  transition: all 0.2s ease;
}

.submit:after {
  content: "\0279C";
  color: #FCFBF9;
  top: 0;
  left: 100%;
  position: absolute;
  width: 30px;
  height: 100%;
  z-index: -2;
  font-family: 'Space Mono', monospace;
  font-size: 2em;
  display: flex;
  justify-content: center;
  align-items: center;
  transform: translateX(0px);
  background: #fb6868;
  pointer-events: auto;
  transition: all 0.2s ease;
}

.submit:before {
  position: absolute;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  content: '';
  background: transparent;
}

.submit:hover::after {
  transform: translateX(0px);
}

.submit:hover,
.submit::after {
  transform: translateX(-30px);
}

#button {
  position: absolute;
  transform: translateY(460px);
  width: 100%;
  height: 40px;
  color: #3C2FA4;
  font-style: italic;
  font-size: 0.8em;
  border-bottom-right-radius: 3px;
  border-bottom-left-radius: 3px;
  background: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

#button:hover {
  cursor: pointer;
}

#button:before {
  content: "";
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  background: #fb6868;
  z-index: -1;
  transform: translateX(-100%) translateY(calc(2px - 100%));
  opacity: 0;
}

#button:hover::before {
  transition: transform .7s cubic-bezier(.19, 1, .22, 1);
  transform: translateX(0%) translateY(calc(2px - 100%));
  opacity: 1;
}

#button:after {
  content: "";
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  width: 100%;
  height: 100%;
  position: absolute;
  background: #fb6868;
  z-index: -2;
  transition: transform .8s cubic-bezier(.19, 1, .22, 1);
  transform: translateX(100%) translateY(calc(2px - 100%));
  opacity: 1;
}

#button:hover::after {
  transition: none;
  transform: translateX(0%) translateY(calc(2px - 100%));
  opacity: 0;
}
              
            
!

JS

              
                /*global console, alert, confirm, prompt*/
var forms = document.forms;
p = document.querySelectorAll('p'),
  input = document.querySelectorAll('input:not([type="submit"])'),
  submit = document.querySelectorAll('input[type="submit"]');
password = input[2],
  password2 = document.getElementById('passwordIn'),
  email = input[1],
  email2 = document.getElementById('emailIn');

[].forEach.call(input, function(inputE) {
  'use strict';

  inputE.addEventListener('focus', function() {
    'use strict';
    inputE.parentNode.previousElementSibling.style.color = '#FDED62';
    inputE.style.transform = 'translate(5px, 5px)';
  });

  inputE.addEventListener('blur', function() {
    'use strict';
    console.log('blur');
    inputE.parentNode.previousElementSibling.style.color = '#fff';
    inputE.style.transform = 'translate(0px, 0px)';
  });
  /*
  inputE.addEventListener('mouseout', function () {
      'use strict';
      console.log('out');
      inputE.style.transform = 'translate(0px, 0px)';
  });

  inputE.addEventListener('mouseover', function () {
      'use strict';
      inputE.style.transform = 'translate(5px, 5px)';
  });
  */
});

function checkPassword(e) {
  'use strict';
  var el = e.target;
  console.log(el);
  if (el.value.length < 8 && el.value.length !== 0) {
    el.parentNode.previousElementSibling.style.color = '#FB6868';
  } else {
    el.parentNode.previousElementSibling.style.color = '#FDED62';
  }
}

function checkEmail(e) {
  'use strict';
  var el = e.target;
  var reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;

  if (!reg.test(el.value) && el.value !== '') {
    el.parentNode.previousElementSibling.style.color = '#FB6868';
  } else {
    el.parentNode.previousElementSibling.style.color = '#FDED62';
  }
}

password.addEventListener('input', checkPassword);
password.addEventListener('focus', checkPassword);
email.addEventListener('input', checkEmail);
email.addEventListener('focus', checkEmail);
submit[0].addEventListener('click', function(e) {
  'use strict';
  e.preventDefault();
});

password2.addEventListener('input', checkPassword);
password2.addEventListener('focus', checkPassword);
email2.addEventListener('input', checkEmail);
email2.addEventListener('focus', checkEmail);
submit[1].addEventListener('click', function(e) {
  'use strict';
  e.preventDefault();
});

var button = document.getElementById('button'),
  wrapper = document.getElementById('wrapper'),
  c = true,
  one = document.getElementById('one'),
  two = document.getElementById('two');

button.addEventListener('click', function() {
  'use strict';
  if (c) {
    one.style.pointerEvents = 'none';
    two.style.pointerEvents = 'auto';
    one.style.opacity = '0.1';
    two.style.opacity = '1';
    one.style.transform = 'translateX(100%)';
    two.style.transform = 'translateX(0%)';
    button.textContent = 'Sign Up';

    c = false;
  } else {
    one.style.pointerEvents = 'auto';
    two.style.pointerEvents = 'none';
    one.style.opacity = '1';
    two.style.opacity = '0.1';
    one.style.transform = 'translateX(0%)';
    two.style.transform = 'translateX(-100%)';
    button.textContent = 'Sign In';

    c = true;
  }

});
              
            
!
999px

Console