// Form Mixin
mixin form
  .module.form-module
    .toggle
      i.fa.fa-times.fa-pencil
      .tooltip Click Me
    .form
      h2 Login to your account
      form
        input(type='text' placeholder='Username')
        input(type='password' placeholder='Password')
        button Login
    .form
      h2 Create an account
      form
        input(type='text' placeholder='Username')
        input(type='password' placeholder='Password')
        input(type='email' placeholder='Email Address')
        input(type='tel' placeholder='Phone Number')
        button Register
    .cta
      a(href='http://andytran.me') Forgot your password?

// Input Mixin
mixin input(type, placeholder)
  input(type=type
        placeholder=placeholder)

// Button Mixin
mixin button(value)
  button=value
  
// Pen Title
.pen-title
  h1 Flat Login Form
  span
    | Pen <i class='fa fa-paint-brush'></i> + <i class='fa fa-code'></i> by <a href='http://andytran.me'>Andy Tran</a>
// Form Module
+form
View Compiled
@import 'bourbon';

// Main Colors
$accent: null;
$white: #ffffff;
$black: #000000;
$dark-gray: lighten($black, 20%);
$gray: lighten($black, 40%);
$light-gray: lighten($black, 60%);
$lighter-gray: lighten($black, 80%);

// Pen Settings
$accent: #33b5e5;
$module-width: 320px;

body {
  background: #e9e9e9;
  color: $gray;
  font-family: 'RobotoDraft', 'Roboto', sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Pen Title */
.pen-title {
  padding: 50px 0;
  text-align: center;
  letter-spacing: 2px;
  h1 {
    margin: 0 0 20px;
    font-size: 48px;
    font-weight: 300;
  }
  span {
    font-size: 12px;
    .fa {
      color: $accent;
    }
    a {
      color: $accent;
      font-weight: 600;
      text-decoration: none;
    }
  }
}

/* Form Module */
.form-module {
  position: relative;
  background: $white;
  max-width: $module-width;
  width: 100%;
  border-top: 5px solid $accent;
  box-shadow: 0 0 3px rgba($black, .1);
  margin: 0 auto;
  .toggle {
    cursor: pointer;
    position: absolute;
    top: -0;
    right: -0;
    background: $accent;
    width: 30px;
    height: 30px;
    margin: -5px 0 0;
    color: $white;
    font-size: 12px;
    line-height: 30px;
    text-align: center;
    .tooltip {
      position: absolute;
      top: 5px;
      right: -65px;
      display: block;
      background: rgba($black, .6%);
      width: auto;
      padding: 5px;
      font-size: 10px;
      line-height: 1;
      text-transform: uppercase;
      &:before {
        content: '';
        position: absolute;
        top: 5px;
        left: -5px;
        display: block;
        border-top: 5px solid transparent;
        border-bottom: 5px solid transparent;
        border-right: 5px solid rgba($black, .6);
      }
    }
  }
  .form {
    display: none;
    padding: 40px;
    &:nth-child(2) {
      display: block;
    }
  }
  h2 {
    margin: 0 0 20px;
    color: $accent;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
  }
  input {
    outline: none;
    display: block;
    width: 100%;
    border: 1px solid darken($white, 15%);
    margin: 0 0 20px;
    padding: 10px 15px;
    box-sizing: border-box;
    font-wieght: 400;
    @include transition(.3s ease);
    &:focus {
      border: 1px solid $accent;
      color: $dark-gray;
    }
  }
  button {
    cursor: pointer;
    background: $accent;
    width: 100%;
    border: 0;
    padding: 10px 15px;
    color: $white;
    @include transition(.3s ease);
    &:hover {
      background: darken($accent, 15%);
    }
  }
  .cta {
    background: darken($white, 5%);
    width: 100%;
    padding: 15px 40px;
    box-sizing: border-box;    
    color: $gray;
    font-size: 12px;
    text-align: center;
    a {
      color: $dark-gray;
      text-decoration: none;
    }
  }
}
View Compiled
// Toggle Function
$('.toggle').click(function(){
  // Switches the Icon
  $(this).children('i').toggleClass('fa-pencil');
  // Switches the forms  
  $('.form').animate({
    height: "toggle",
    'padding-top': 'toggle',
    'padding-bottom': 'toggle',
    opacity: "toggle"
  }, "slow");
});

External CSS

  1. https://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900|RobotoDraft:400,100,300,500,700,900
  2. https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js
  2. https://codepen.io/andytran/pen/vLmRVp.js