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

              
                // Pen Title
.pen-title
  h1 
    <span>(Tutorial)</span>
    | 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>
    
// Portfolio
a#portfolio(href='http://andytran.me/' title='View my portfolio!')
  i.fa.fa-link
  
// CodePen
a#codepen(href='https://codepen.io/andytran/' title='Follow me!')
  i.fa.fa-codepen

//- Input Mixin
mixin input(type, name, placeholder, label)
  .form-group
    input(type=type
          id=name
          placeholder=placeholder
          required)
    label(for=name)=label
    .line

//- Button Mixin
mixin button(label)
  button.button=label

//- Form Container Mixin
mixin form-container
  .form-container
    block
  
//- Form Mixin
mixin form(name, width, color, style)
  if style == '1'
    style(type='text/css').
      .style-1 .header h1 {
        color: #{color};
      }
      
      .style-1 .form-group input:valid,
      .style-1 .form-group input:focus {
        color: #{color};
      }
      
      .style-1 .form-group input:valid ~ .line,
      .style-1 .form-group input:focus ~ .line {
        background: #{color};
      }
      
      .style-1 .button {
        background: #{color};
      }
      
  if style == '2'
    style(type='text/css').
      .style-2 .header { 
        background: #{color};
      }
      
      .style-2 .form-group input:valid,
      .style-2 .form-group input:focus {
        color: #{color};
      }
      
      .style-2 .form-group input:valid ~ .line,
      .style-2 .form-group input:focus ~ .line {
        background: #{color};
      }
      
      .style-2 .button {
        background: #{color};
      }
      
  .form(class='style-#{style}'
        style='width: #{width};')
    header.header
      h1.active Sign In
      h1 Sign Up
    block
    footer.footer
      a(href='#') Forgot your password?
      
// Container
.container
  // Column
  .col
    // Form Container
    +form-container
      +form('Sign Up', '360px', '#33b5e5', '1')
        form.active
          +input('text', 'username', 'Username', 'Username')
          +input('password', 'password', 'Password', 'Password')
          +button('Login')
        form
          +input('text', 'username', 'Username', 'Username')
          +input('email', 'email', 'Email Address', 'Email Address')
          +input('password', 'password', 'Password', 'Password')
          +button('Login')
      p Not registered? 
        a.toggle(href='#') Sign up

  // Colum
  .col
    // Form Container
    +form-container
      +form('Sign Up', '360px', '#2c3e50', '2')
        form.active
          +input('text', 'username', 'Username', 'Username')
          +input('password', 'password', 'Password', 'Password')
          +button('Login')
        form
          +input('text', 'username', 'Username', 'Username')
          +input('email', 'email', 'Email Address', 'Email Address')
          +input('password', 'password', 'Password', 'Password')
          +button('Login')
      p Not registered? 
        a.toggle(href='#') Sign up
  
// Tip
#tip
  h1 How to create a form?
  p It's really simple... If you have basic knowledge of Jade. Simple fill out the paramaters in the mixin below, drop it below this box, and watch as magic happens!
  code
   h1 Jade
   p 
     | Please note that these are case sensitive. <br>
     | /* Mixin Guide<br>
     | * Form Container Mixin<br>
     | * +form-container<br>
     | *<br>
     | * Form Mixin<br>
     | * +form('name', 'width', 'color', 'style')<br>
     | *<br>
     | * Input Mixin<br>
     | * +input('type', 'name', 'placeholder', 'label')<br>
     | *<br>
     | * Button Mixin<br>
     | * +button('label')<br>
     | */<br><br>
   p <span>+form-container</span>
   p <span>+form</span><span>.active</span>(<span>'name'</span>, <span>'width'</span>, <span>'color'</span>, <span>'style'</span>)
   p <span>+input</span>(<span>'type'</span>, <span>'name'</span>, <span>'placeholder'</span>, <span>'label'</span>)
   p <span>+input</span>(<span>'type'</span>, <span>'name'</span>, <span>'placeholder'</span>, <span>'label'</span>)
   p <span>+button</span>(<span>'label'</span>)
   p <span>+form</span>(<span>'name'</span>, <span>'width'</span>, <span>'color'</span>, <span>'style'</span>)
   p <span>+input</span>(<span>'type'</span>, <span>'name'</span>, <span>'placeholder'</span>, <span>'label'</span>)
   p <span>+input</span>(<span>'type'</span>, <span>'name'</span>, <span>'placeholder'</span>, <span>'label'</span>)
   p <span>+button</span>(<span>'label'</span>)
   P <span>p</span> Not registered? 
   P <span>a</span><span>.toggle</span>(<span>href</span>='#') Sign up
  h1 Browser Support?
  p Tested on the latest versions of <b>Chrome</b>, <b>Firefox</b>, <b>Safari</b>, <b>Internet Explorer</b>, &amp; <b>Opera</b>.
  p Best viewed in Chrome because... I said so.
  
// Portfolio
a#portfolio(href='http://andytran.me/' title='View my portfolio!')
  i.fa.fa-link
  
// CodePen
a#codepen(href='https://codepen.io/andytran/' title='Follow me!')
  i.fa.fa-codepen
  
// Scroll To Bottom
a#scrollToBottom(href='#tip' title='Check out the tutorial!')
  i.material-icons &#xE313;
              
            
!

CSS

              
                // 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%);

// Font Weight
$thin: 100;
$light: 300;
$regular: 400;
$semibold: 600;
$bold: 700;

// Pen Settings
$primary: #2c3e50;
$accent: #33b5e5;
$max-width: 460px;
$gutters: 24px;

// Mixins
$level: 1;

@mixin elevation($level) {
  @if $level == 1 {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  }

  @else if $level == 2 {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
  }

  @else if $level == 3 {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
  }

  @else if $level == 4 {
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
  }

  @else if $level == 5 {
    box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.22);
  }
}

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 {
      display: block;
      margin: 0 0 10px;
      color: $accent;
      font-size: 18px;
      font-weight: $semibold;
      text-transform: uppercase;
    }
  }

  span {
    font-size: 12px;

    .fa {
      color: $accent;
    }

    a {
      color: $accent;
      font-weight: 600;
      text-decoration: none;
    }
  }
}

/* Rerun */
.rerun {
  margin: 0 0 30px;
  text-align: center;

  a {
    cursor: pointer;
    display: inline-block;
    background: $accent;
    border-radius: 3px;

    @include elevation(1);

    padding: 10px 20px;
    color: $white;
    text-decoration: none;
    transition: .3s ease;

    &:hover {
      @include elevation(2);
    }
  }
}

/* Scroll To Bottom */
#codepen {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: $primary;
  width: 56px;
  height: 56px;
  border-radius: 100%;

  @include elevation(1);

  transition: .3s ease;
  color: $white;
  text-align: center;

  i {
    line-height: 56px;
  }

  &:hover {
    @include elevation(3);
  }
}

/* CodePen */
#portfolio {
  @extend #codepen;

  bottom: 96px;
  right: 36px;
  background: $accent;
  width: 44px;
  height: 44px;
  animation: buttonFadeInUp 1s ease;

  i {
    line-height: 44px;
  }
}

/* Container */
.container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  max-width: 1140px;
  margin: 0 auto 100px;
  text-align: center;
}

/* Column */
.col {
  display: block;
  width: 50%;
  float: left;
}

/* Form Container */
.form-container {
  display: inline-block;
  text-align: center;

  p {
    padding: $gutters 0;
    color: $gray;
    font-size: 12px;

    a {
      color: $dark-gray;
      font-weight: $bold;
      text-decoration: none;
    }
  }
}

/* Form */
.form {
  display: block;
  background: $white;
  margin: 0 auto;
  padding: $gutters ($gutters * 2) ($gutters * 2);
  box-sizing: border-box;

  @include elevation(1);

  .header {
    padding: $gutters 0;
    text-align: center;

    h1 {
      display: none;
      color: $accent;
      font-size: 24px;

      &.active {
        display: block;
      }
    }
  }

  .footer {
    text-align: center;

    a {
      color: $gray;
      font-size: 12px;
      text-decoration: none;
    }
  }

  form {
    display: none;

    &.active {
      display: block;
    }
  }

  .form-group {
    position: relative;
    margin: 0 0 $gutters;

    &:last-of-type {
      margin: 0 0 ($gutters * 1.5);
    }

    label {
      display: none;
    }

    input {
      outline: 0;
      background: transparent;
      width: 100%;
      border: 0;
      border-bottom: 1px solid $light-gray;
      padding: $gutters / 2;
      font-size: 14px;
      box-sizing: border-box;

      &:valid,
      &:focus {
        color: $accent;

        ~ .line {
          background: $accent;
          width: 100%;
        }
      }
    }

    .line {
      position: absolute;
      bottom: 0;
      left: 0;
      background: transparent;
      width: 0%;
      height: 2px;
      transition: .6s ease;
    }
  }

  .button {
    cursor: pointer;
    position: relative;
    outline: none;
    background: $accent;
    width: 100%;
    margin: 0 0 $gutters;
    padding: ($gutters / 2) $gutters;
    border: 0;
    border-radius: 100px;
    color: $white;
    font-family: 'RobotoDraft', 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: $semibold;
    text-align: center;
    text-transform: uppercase;
    overflow: hidden;

    &:hover {
      &:before {
        left: -10%;
      }
    }

    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: -100%;
      background: rgba($white, 0.3);
      width: 60%;
      height: 100%;
      transform: skew(-45deg);
      transition: .3s ease;
    }
  }
}

.style-2 {
  .header {
    background: $accent;
    margin: (-$gutters) (-$gutters * 2) $gutters;
    padding: ($gutters * 2) $gutters;

    h1 {
      color: $white;
    }
  }

  .form-group {
    label {
      position: absolute;
      top: 12px;
      left: 12px;
      display: block;
      font-size: 14px;
      transition: .2s ease;
    }

    input {
      &:focus,
      &:valid {
        ~ label {
          font-size: 12px;
          text-transform: uppercase;
          transform: translate(-8px, -18px) scale(0.75);
        }
      }

      &::-webkit-input-placeholder {
        color: transparent;
      }
    }
  }

  .button {
    border-radius: 0;
  }
}

/* Tip */
#tip {
  max-width: 600px;
  border-radius: 3px;
  margin: 0 auto 100px;
  line-height: 1.7em;
  text-align: center;

  h1 {
    margin: 0 0 10px;
    color: $dark-gray;
    font-size: 24px;
    font-weight: 300;
  }

  p {
    margin: 0 0 10px;
    color: $gray;

    b {
      font-weight: $semibold;
    }
  }

  code {
    display: block;
    background: #232e34;
    margin: 0 0 100px;
    padding: 10px 20px;
    color: #CDD3DE;
    letter-spacing: 2px;
    text-align: left;

    h1 {
      dsplay: block;
      background: #263238;
      margin: -10px -20px 20px;
      padding: 10px 20px;
      color: #CDD3DE;
      font-size: 18px;

      &:before {
        content: '\f121';
        display: inline-block;
        margin: 0 10px 0 0;
        color: #546E7A;
        font: normal normal normal 14px/1 FontAwesome;
        font-size: inherit;
        text-rendering: auto;
        transform: translate(0, 0);
      }
    }

    p {
      margin: 0;
      color: inherit;

      &:nth-child(2) {
        color: #C3E88D;
      }

      &:nth-child(4),
      &:nth-child(8),
      &:nth-child(12) {
        margin: 0 0 0 ($gutters / 2);
      }

      &:nth-child(5),
      &:nth-child(6),
      &:nth-child(7),
      &:nth-child(9),
      &:nth-child(10),
      &:nth-child(11),
      &:nth-child(13) {
        margin: 0 0 0 $gutters;
      }

      span {
        color: #C38FE5;

        &:nth-child(2),
        &:nth-child(3),
        &:nth-child(4),
        &:nth-child(5),
        &:nth-child(6) {
          color: #FF5370;
        }
      }
    }
  }
}


@media (max-width: 768px) {
  .col {
    width: 100%;
  }
}
              
            
!

JS

              
                // Toggle Function
$('.toggle').click(function(){
  $('form').animate({
    height: 'toggle',
    opacity: "toggle"
  }, "slow");
});
              
            
!
999px

Console