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

              
                .container
  .card-wrap
  
    .card.border-0.shadow.card--welcome.is-show#welcome
      .card-body
        h2.card-title WELCOME
        p Welcome to the login page
        .btn-wrap
          a(data-target="register").btn.btn-lg.btn-register.js-btn REGISTER
          a(data-target="login").btn.btn-lg.btn-login.js-btn LOGIN
          
    .card.border-0.shadow.card--register#register
      .card-body
        h2.card-title Create Account
        p.card-text Enter your personal details
          br
          | and start journey with us
        p.badge-wrap
          a.badge: i.fab.fa-facebook-f
          a.badge: i.fab.fa-google
          a.badge: i.fab.fa-twitter
          a.badge: i.fab.fa-github
        p or use your email for registration
        form
          .form-group
            input(type='text' placeholder='Name' required).form-control
          .form-group
            input(type='email' placeholder='Email' required).form-control
          .form-group
            input(type='password' placeholder='Password' required).form-control
          button.btn.btn-lg REGISTER
      button(data-target="welcome").btn.btn-back.js-btn: i.fas.fa-angle-left
          
    .card.border-0.shadow.card--login#login
      .card-body
        h2.card-title Welcome Back!
        p To keep connected with us
          br
          | please login with your personal info
        p.badge-wrap
          a.badge: i.fab.fa-facebook-f
          a.badge: i.fab.fa-google
          a.badge: i.fab.fa-twitter
          a.badge: i.fab.fa-github
        p or use your account
        form
          .form-group
            input(type='email' placeholder='Email' required).form-control
          .form-group
            input(type='password' placeholder='Password' required).form-control
          p: a Forgot your password?
          button.btn.btn-lg LOGIN
      button(data-target="welcome").btn.btn-back.js-btn: i.fas.fa-angle-left
              
            
!

CSS

              
                /* -∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-
  Settings
-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-*/
@use postcss-simple-vars;
@use postcss-discard-comments{
  removeAllButFirst: false
};
@use postcss-preset-env{
  stage: 0,
  browsers: "last 3 versions, ie >= 11",
  features: {
    'nesting-rules': false
  }
};
@use postcss-nested;
@use postcss-custom-media;
@custom-media --pc (min-width: 769px);
@custom-media --sp (max-width: 768px);

/*-------------------------*/

$register: #ee9ca7;
$register--weak: rgba(238,156,167,.25);
$login: #a7bfe8;
$login--weak: rgba(167,191,232,.25);
$grad: linear-gradient(to right, #ffdde1, #ee9ca7, #a7bfe8, #6190e8);
$font-family: 'Josefin Sans', sans-serif;



/* -∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-
  Main Styles
-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-*/
body {
  display: flex;
  height: 100vh;
  min-height: 35rem;
  align-items: center;
  justify-content: center;
  font-family: $font-family;
}

.card {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 100%;
  padding-top: 1rem;
  padding-bottom: 1rem;
	transform: translate(-50%,-50%);
}

.card-wrap {
	position: relative;
  margin: 0 auto;
  @media (--pc) {
    max-width: 450px;
  }
}

.card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  p {
    font-size: 1.1rem;
  }
}

.card-title {
  font-weight: bold;
  font-size: 1.8rem;
}

.badge-wrap {
  display: flex;
  justify-content: center;
  a.badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: 0 .2rem;
    padding: 0;
    opacity: .7;
    border-radius: 50%;
    transition: opacity .3s ease-in;
    font-size: 1rem;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    &:hover {
      opacity: 1;
      color: #fff;
    }
  }
}

.btn {
  color: #fff !important;
	width: 10em;
	transition: all .4s;
	border-radius: 20px;
	border: 2px solid transparent;
}
.btn.btn-back {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 0;
  width: 3rem;
  height: 3rem;
  font-size: 1.5rem;
  border: 0;
  &:hover {
    border: 0 !important;
  }
}

.form-control {
  font-family: 'Handle', cursive;
  &::placeholder {
    font-family: $font-family;
    letter-spacing: .1em;
    font-size: .9rem;
  }
}


/* -∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-
  State
-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-*/

/* Welcome
---------------------------------------*/
.card--welcome {
  z-index: 3;
  .card-title {
    color: $register;
  }
  .btn-wrap {
    display: flex;
    flex-direction: column;
  }
  .btn {
    color: #fff;
    transition: all .3s;
    &:hover {
      background-color: $register--weak;
      font-weight: bold;
    }
  }
  .btn-register {
    margin-bottom: .8em;
    background-color: $register;
    &:hover {
      color: $register;
    }
  }
  .btn-login {
    background-color: $login;
  }
}

/* Register
---------------------------------------*/
.card--register {
  .card-title {
    color: $register;
  }
  .badge {
    background-color: $register;
  }
  .btn {
    background-color: $register;
		&:hover {
			background-color: #fff;
			color: $register !important;
			font-weight: bold;
			border: 2px solid $register--weak;
		}
    &:focus {
      box-shadow: 0 0 0 0.2rem $register--weak;
    }
  }
  .form-control {
    color: $register;
    border-color: $register--weak;
    &:focus {
      box-shadow: 0 0 0 0.2rem $register--weak;
    }
  }
}

/* Login
---------------------------------------*/
.card--login {
  .card-title {
    color: $login;
  }
  .badge {
    background-color: $login;
  }
  .btn {
    background-color: $login;
		&:hover {
			background-color: #fff;
			color: $login !important;
			font-weight: bold;
			border: 2px solid $login--weak;
		}
    &:focus {
      box-shadow: 0 0 0 0.2rem $login--weak;
    }
  }
  .form-control {
    color: $login;
    border-color: $login--weak;
    &:focus {
      box-shadow: 0 0 0 0.2rem $login--weak;
    }
  }
}



/* -∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-
  Animation
-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-∵-∴-*/
body {
	background: $grad;
  background-size: 500% 500%;
  transition: background 3s ease;
  background-position: 50% 50%;

	&.is-register {
  	background-position: 0% 50%;
	}
  &.is-login {
    background-position: 100% 50%;
  }
}
.card {
	transition: all .3s .1s ease-out;
	&:not(.is-show) {
		opacity: 0;
		transform: translate(-50%,-50%) rotateX(95deg);
	}
	&.is-show {
		opacity: 1;
		transform: translate(-50%,-50%);
    z-index: 5;
	}
}
              
            
!

JS

              
                const cards = document.querySelectorAll('.card');

/* View Controller
-----------------------------------------*/
const btns = document.querySelectorAll('.js-btn');
btns.forEach((btn) => {
  btn.addEventListener('click', on_btn_click, true);
  btn.addEventListener('touch', on_btn_click, true);
});

function on_btn_click (e) {
  const nextID = e.currentTarget.getAttribute('data-target');
  const next = document.getElementById(nextID);
  if(!next) return;
  bg_change(nextID);
  view_change(next);
  return false;
}

/* Add class to the body */
function bg_change(next) {
  document.body.className = '';
  document.body.classList.add('is-'+next);
}

/* Add class to a card */
function view_change(next) {
  cards.forEach((card) => { card.classList.remove('is-show'); });
  next.classList.add('is-show');
}
              
            
!
999px

Console