Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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

              
                <div class="form-container">
  <span class="arrow" onclick="arrowClick();"><i class="fa fa-arrow-circle-left" aria-hidden="true"></i></span>
  <img src="https://images.unsplash.com/photo-1489703197108-878f05f4b31b?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=943be4a53094e573abf05d8b1f20aced&auto=format&fit=crop&w=1504&q=80" alt="Background image" class="bg">
  <div class="overlay"></div>
  <div class="choose-form">
    <div class="logo">
      <i class="fa fa-snowflake-o" aria-hidden="true"></i>
      <h1>snow<span class="bold">flake</span></h1>
    </div>
    <div class="buttons">
      <a href="#" class="button button-signup" onclick="signUp();">Sign up</a>
      <a href="#" class="button button-login" onclick="login();">Login</a>
    </div>
  </div>
  <div class="login-form form">
    <div class="form-wrapper">
      <form method="post">
        <label for="login-username">Username</label>
        <input id="login-username" type="text" placeholder="Username" name="username" required>
        <label for="login-password">Password</label>
        <input id="login-password" type="password" placeholder="Password" name="password" pattern=".{3,}" title="Password must contain at least 3 characters" required>
        <a href="#" class="forgot-password">Forgot password?</a>
        <button type="submit" class="button button-submit">Login</button>
      </form>
      <div class="social-media">
        <h6>Or connect with</h6>
        <a href="#" class="button button-facebook"><i class="fa fa-facebook" aria-hidden="true"></i>&nbsp;facebook</a>
        <a href="#" class="button button-google"><i class="fa fa-google" aria-hidden="true"></i>&nbsp;google</a>
      </div>
    </div>
  </div>
  <div class="register-form form">
    <div class="form-wrapper">
      <form method="post">
        <label for="signup-email">Email</label>
        <input id="signup-email" type="email" placeholder="example@hotmail.com" name="email" required>
        <label for="signup-username">Username</label>
        <input id="signup-username" type="text" placeholder="Username" name="username" required>
        <label for="signup-password">Password</label>
        <input id="signup-password" type="password" placeholder="Password" name="password" pattern=".{3,}" title="Password must contain at least 3 characters" required>
        <button type="submit" class="button button-submit">Sign up</button>
      </form>
      <div class="social-media">
        <h6>Or connect with</h6>
        <a href="#" class="button button-facebook"><i class="fa fa-facebook" aria-hidden="true"></i>&nbsp;facebook</a>
        <a href="#" class="button button-google"><i class="fa fa-google" aria-hidden="true"></i>&nbsp;google</a>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Raleway:300,500,600');

@mixin elmPos($position, $margin, $top, $right, $bottom, $left, $width, $height) {
  position: $position;
  margin: $margin;
  top: $top;
  right: $right;
  bottom: $bottom;
  left: $left;
  width: $width;
  height: $height;
}

@mixin elmFont($textAlign, $textTransform, $textDecoration, $letterSpacing, $fontSize, $fontWeight, $color) {
  text-align: $textAlign;
  text-transform: $textTransform;
  text-decoration: $textDecoration;
  letter-spacing: $letterSpacing;
  font-size: $fontSize;
  font-weight: $fontWeight;
  color: $color;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  // background: rgb(88, 108, 119);
  background: #3a6186;  /* fallback for old browsers */
  background: -webkit-linear-gradient(left, #89253e, #3a6186);
  background: -o-linear-gradient(left, #89253e, #3a6186);
  background: linear-gradient(to left, #89253e, #3a6186);  /* Chrome 10-25, Safari 5.1-6 */ /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
  font-family: 'Raleway', sans-serif;
}

.form-container {
  @include elmPos(absolute, auto, 0, 0, 0, 0, 300px, 550px);
  box-shadow: 1px 1px 25px rgba(0, 0, 0, 0.2);
  border-radius: 5px;
  overflow: hidden;
  span.arrow {
    @include elmPos(absolute, auto, 5px, initial, initial, -30px, 10px, 10px);
    color: lightblue;
    z-index: 5;
    opacity: 1;
    transition: left 2s;
    &:hover {
      cursor: pointer;
    }
  }
  img {
    @include elmPos(absolute, initial, initial, initial, initial, initial, 100%, 100%);
    object-fit: cover;
    filter: grayscale(50%);
    opacity: 0.2;
    z-index: -1;
  }
  .overlay {
    @include elmPos(absolute, initial, initial, initial, initial, initial, inherit, inherit);
    background: rgba(214, 214, 214, 0.1);
    z-index: -1;
    transition: opacity 1s;
  }
  .choose-form {
    @include elmPos(absolute, initial, initial, initial, initial, initial, inherit, inherit);
    z-index: 4;
    .logo {
      @include elmPos(absolute, auto, -100px, 0, 0, 0, inherit, 100px);
      text-align: center;
      color: white;
      transition: right 2s;
      i {
        font-size: 30px;
      }
      h1 {
        font-weight: 300;
        span.bold {
          font-weight: 600;
        }
      }
    }
    .buttons {
      text-align: center;
      @include elmPos(absolute, auto, 200px, 0, 0, 0, inherit, 100px);
      a {
        @include elmFont(inherit, uppercase, none, 0.1em, 12px, 500, white);
        &:hover {
          background: white;
          color: lightblue;
          border: 1px solid lightblue;
        }
      }
      .button-login {
        transition: right 2s;
        transition-delay: .8s;
        @include elmPos(absolute, auto, 40px, 0, 0, 0, 200px, 30px);
      }
      .button-signup {
        transition: right 2s;
        transition-delay: .5s;
        @include elmPos(absolute, auto, -40px, 0, 0, 0, 200px, 30px);
      }
    }
  }
  .login-form {
    opacity: 0;
    transition: opacity 2s;
  }
  .register-form {
    opacity: 0;
    transition: opacity 2s;
  }
  .form {
    @include elmPos(absolute, auto, 0, 0, 0, 0, inherit, 400px);
    text-align: center;
    .form-wrapper {
      width: 250px;
      height: 200px;
      margin: 0 auto;
      display: block;
      label {
        display: block;
        @include elmFont(left, uppercase, initial, 0.1em, 12px, 600, lightblue);
      }
      input {
        width: 250px;
        height: 30px;
        margin: 5px 0 10px 0;
        outline: none;
        border: none;
        background: none;
        border-bottom: 1px solid lightblue;
        font-size: 12px;
        color: lightblue;
        &::placeholder {
          color: rgba(19, 28, 36, 0.5);
          opacity: 1;
        }
      }
      a.forgot-password {
        display: block;
        @include elmFont(right, uppercase, none, 0.1em, 12px, 500, lightblue);
        &:hover {
          opacity: 0.5;
        }
      }
      button.button-submit {
        @include elmFont(center, uppercase, none, 0.1em, 12px, 500, white);
        background: none;
        outline: none;
        &:hover {
          background: white;
          color: lightblue;
          border: 1px solid lightblue;
          cursor: pointer;
        }
      }
      .social-media {
        @include elmPos(absolute, auto, initial, 0, 0, 0, inherit, initial);
        h6 {
          text-transform: uppercase;
          color: lightblue;
          &::before {
            content: "";
            @include elmPos(absolute, auto, 6px, initial, 0, 0, 65px, initial);
            border-top: 1px solid lightblue;
          }
          &::after {
            content: "";
            @include elmPos(absolute, auto, 6px, 0, 0, initial, 65px, initial);
            border-top: 1px solid lightblue;
          }
        }
        .button-facebook {
          border: none;
          background: rgb(59, 89, 152);
          @include elmFont(center, initial, none, initial, 12px, 600, white);
          opacity: 0.8;
          &:hover {
            opacity: 1;
          }
        }
        .button-google {
          border: none;
          background: rgb(219, 50, 54);
          @include elmFont(center, initial, none, initial, 12px, 600, white);
          opacity: 0.8;
          &:hover {
            opacity: 1;
          }
        }
      }
    }
  }
}

.button {
  margin: 10px auto;
  padding: 7px 0;
  border-radius: 10px;
  border: 1px solid white;
  width: 200px;
  height: 30px;
  display: block;
  outline: none;
}

              
            
!

JS

              
                // Elements selectors
const elm = {
  signUpButton: document.querySelector(".button-signup"),
  loginButton: document.querySelector(".button-login"),
  overlay: document.querySelector(".overlay"),
  logo: document.querySelector(".logo"),
  arrow: document.querySelector(".arrow"),
  registerForm: document.querySelector(".register-form"),
  loginForm: document.querySelector(".login-form")
};

// Properties object
const props = {
  right: "right: -550px;",
  left: "left: 5px;",
  opacity0: "opacity: 0;",
  opacity1: "opacity: 1;",
  trnsDelay: "transition-delay: 1s;",
  zIndex: "z-index: 6;",
  right0: "right: 0;",
  left0: "left: 0;",
  trnsDelay0: "transition-delay: 0s;",
  zIndex0: "z-index: 0;",
  leftM30: "left: -30px;"
};

// Elements array
const elms = [elm.signUpButton, elm.loginButton, elm.overlay, elm.logo, elm.arrow, elm.registerForm, elm.loginForm];

function transition(elements, props) {
  for (let i = 0; i < elements.length; i++) {
    elements[i].setAttribute("style", `${props[i]}`);
  }
}

function signUp() {
  const properties = [props.right, props.right, props.opacity0, props.right, props.left, `${props.opacity1} ${props.trnsDelay} ${props.zIndex}`, props.opacity0];

  transition(elms, properties);
}

function login() {
  const properties = [props.right, props.right, props.opacity0, props.right, props.left, props.opacity0, `${props.opacity1} ${props.trnsDelay} ${props.zIndex}`];

  transition(elms, properties);
}

function arrowClick() {
  const properties = [props.right0, props.right0, props.opacity1, props.right0, props.leftM30, `${props.opacity0} ${props.trnsDelay0} ${props.zIndex0}`, `${props.opacity0} ${props.trnsDelay0} ${props.zIndex0}`];

  transition(elms, properties);
}

              
            
!
999px

Console