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

              
                <section class="wrapper">
	<div class="box">
		<h1>From left</h1>
		<div class="st-form__input--wrapper from-left">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>From right</h1>
		<div class="st-form__input--wrapper from-right">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>From top</h1>
		<div class="st-form__input--wrapper from-top">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>From bottom</h1>
		<div class="st-form__input--wrapper from-bottom">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>From sides</h1>
		<div class="st-form__input--wrapper from-side">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>From center</h1>
		<div class="st-form__input--wrapper from-center">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>From middle</h1>
		<div class="st-form__input--wrapper from-middle">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>Blink</h1>
		<div class="st-form__input--wrapper blink">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>Half</h1>
		<div class="st-form__input--wrapper half">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>Circle</h1>
		<div class="st-form__input--wrapper circle">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
			<span class="input-border"></span>
		</div>
  </div>

	<div class="box">
		<h1>Bottom border</h1>
		<div class="st-form__input--wrapper just-bottom">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>Top / Bottom border</h1>
		<div class="st-form__input--wrapper top-bottom">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>Partially Top / Bottom border</h1>
		<div class="st-form__input--wrapper partially">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
			<span class="input-border"></span>
		</div>
	</div>

	<div class="box">
		<h1>Enlarge</h1>
		<div class="st-form__input--wrapper enlarge">
			<input type="text" class="st-form__input text" />
			<span class="input-border"></span>
		</div>
	</div>
</section>

              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Source+Sans+Pro:200,400,600);

$black: rgb(0, 0, 0);
$white: lighten($black, 100%);

$dark-blue: rgb(46, 64, 72);
$blue: rgb(1, 175, 209);
$orange: rgb(250, 179, 43);
$medium-green: rgb(55, 200, 123);

$alternate-gray: rgb(250, 250, 250);
$light-gray: rgb(242, 242, 242);
$gray: rgb(212, 212, 212);
$dark-gray: rgb(136, 136, 136);
$turqouise: rgb(18, 121, 142);
$medium-blue: rgb(0, 75, 104);

$yellow: rgb(250, 217, 33);
$red: rgb(208, 61, 60);
$green: rgb(114, 152, 15);
$light-orange: rgb(255, 246, 229);

$anim-speed: 0.3s;
$input-height: 40px;
$input-space: 20px;
$border-width: 2px;
$border-color: $blue;

// Screen size
// --------------------------------------------------------------------------------
$screen-xs: 480px;
$screen-xs-min: $screen-xs;

$screen-sm: 768px;
$screen-sm-min: $screen-sm;

$screen-md: 992px;
$screen-md-min: $screen-md;

$screen-lg: 1200px;
$screen-lg-min: $screen-lg;

$screen-xs-max: ($screen-sm-min - 1);
$screen-sm-max: ($screen-md-min - 1);
$screen-md-max: ($screen-lg-min - 1);


// Cols
// --------------------------------------------------------------------------------
$num-of-cols: 12;
$col-1: percentage(1 / $num-of-cols);
$col-2: percentage(2 / $num-of-cols);
$col-3: percentage(3 / $num-of-cols);
$col-4: percentage(4 / $num-of-cols);
$col-5: percentage(5 / $num-of-cols);
$col-6: percentage(6 / $num-of-cols);
$col-7: percentage(7 / $num-of-cols);
$col-8: percentage(8 / $num-of-cols);
$col-9: percentage(9 / $num-of-cols);
$col-10: percentage(10 / $num-of-cols);
$col-11: percentage(11 / $num-of-cols);
$col-12: percentage(12 / $num-of-cols);

// Mixins
// --------------------------------------------------------------------------------
@mixin size($height, $width) {
  height: $height;
  width: $width;
}

@mixin square($size) {
  @include size($size, $size);
}

@keyframes blink {
  0% {opacity: 0;}
  50% {opacity: 1;}
  55% {opacity: 0;}
  100% {opacity: 1;}
}

* {
  background-repeat: no-repeat;
  box-sizing: border-box;
  font-family: 'Source Sans Pro', sans-serif;
  outline: 0;

  &:before, &:after {
    background-repeat: no-repeat;
    box-sizing: border-box;  
    outline: 0;
  }
}

html, body {
  height: 100%;
}

body {
  background-color: $light-gray;
  font-family: 'Source Sans Pro', sans-serif;
  color: $dark-blue;
  margin: 10px;
}

.wrapper {
  display: flex;
  flex-wrap: wrap;
}

.box {
  flex: 0 0 $col-6;
  padding: 0 10px;
}

h1 {
  font-weight: 400;
  margin-bottom: 10px;
}

.st-form__input--wrapper {
  height: $input-height;
  margin-bottom: $input-space;
  position: relative;
  width: $col-12;

  input[type="text"] {
    @include square($col-12);
    background-color: $white;
    border: solid 1px $gray;
    font-weight: 400;
    padding: 0 10px;
    position: relative;
    z-index: 10;

    &:focus {
      background-color: transparent;
      border-color: transparent;

      & ~ .input-border {
        background-color: $white;

        &:before,
        &:after {
        }
      }
    }
  }

  .input-border {
    bottom: 0;
    display: block;
    left: 0;
    position: absolute;
    top: 0;
    width: 0;

    &:before, &:after {
      bottom: 0;
      content: '';
      display: block;
      position: absolute;
      top: 0;
      width: 0;
      transition: $anim-speed ease-in-out all;
    }

    &:after {
      display: none;
    }
  }

  &.from-left {

    input[type="text"] {

      &:focus ~ .input-border {
        width: 100%;

        &:before,
        &:after {
          width: 100%;
        }
      }
    }

    .input-border {

      &:before {
        box-shadow: inset 0 0 0 $border-width $border-color;
        left: 0;
      }
    }
  }

  &.from-right {

    input[type="text"] {

      &:focus ~ .input-border {
        width: 100%;

        &:before,
        &:after {
          width: 100%;
        }
      }
    }

    .input-border {

      &:before {
        box-shadow: inset 0 0 0 $border-width $border-color;
        right: 0;
      }
    }
  }

  &.from-top {

    input[type="text"] {

      &:focus ~ .input-border {
        width: 100%;

        &:before,
        &:after {
          height: 100%;
        }
      }
    }

    .input-border {

      &:before {
        box-shadow: inset 0 0 0 $border-width $border-color;
        height: 0;
        width: 100%;
      }
    }
  }

  &.from-bottom {

    input[type="text"] {

      &:focus ~ .input-border {
        width: 100%;

        &:before,
        &:after {
          height: 100%;
        }
      }
    }

    .input-border {

      &:before {
        box-shadow: inset 0 0 0 $border-width $border-color;
        top: auto;
        height: 0;
        width: 100%;
      }
    }
  }

  &.from-side {

    input[type="text"] {

      &:focus ~ .input-border {
        opacity: 1;
        width: 100%;

        &:before,
        &:after {
          width: 50%;
        }
      }
    }

    .input-border {
      opacity: 0;

      &:before, &:after {
        box-shadow: none;
        bottom: 0;
        content: '';
        display: block;
        position: absolute;
        top: 0;
        width: 0;
        transition: $anim-speed ease-in-out all;
      }

      &:before {
        border: solid $border-width $border-color;
        border-right: 0;
        left: 0;
      }

      &:after {
        border: solid $border-width $border-color;
        border-left: 0;
        right: 0;
      }
    }
  }

  &.from-center {

    input[type="text"] {

      &:focus ~ .input-border {
        opacity: 1;
        width: 100%;

        &:before,
        &:after {
          width: 50%;
        }
      }
    }

    .input-border {
      opacity: 0;

      &:before, &:after {
        box-shadow: none;
        bottom: 0;
        content: '';
        display: block;
        position: absolute;
        top: 0;
        width: 0;
        transition: $anim-speed ease-in-out all;
      }

      &:before {
        border: solid $border-width $border-color;
        border-left: 0;
        left: 50%;
      }

      &:after {
        border: solid $border-width $border-color;
        border-right: 0;
        right: 50%;
      }
    }
  }

  &.from-middle {

    input[type="text"] {

      &:focus ~ .input-border {
        opacity: 1;
        height: 100%;
        width: 100%;

        &:before,
        &:after {
          height: 100%;
          opacity: 1;
          width: 50%;
        }
      }
    }

    .input-border {
      height: 0;
      opacity: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 100%;

      &:before, &:after {
        box-shadow: none;
        bottom: 0;
        content: '';
        display: block;
        height: 0;
        position: absolute;
        opacity: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 0;
        transition: $anim-speed ease-in-out all;
      }

      &:before {
        border: solid $border-width $border-color;
        border-left: 0;
        left: 50%;
      }

      &:after {
        border: solid $border-width $border-color;
        border-right: 0;
        right: 50%;
      }
    }
  }

  &.blink {

    input[type="text"] {

      &:focus ~ .input-border {
        animation: blink $anim-speed forwards 1 alternate;
        width: 100%;

        &:before,
        &:after {
          width: 100%;
        }
      }
    }

    .input-border {
      opacity: 0;

      &:before, &:after {
        box-shadow: none;
        bottom: 0;
        content: '';
        display: block;
        position: absolute;
        top: 0;
        width: 100%;

      }

      &:before {
        border: solid $border-width $border-color;
        width: 100%;
      }

      &:after {
        display: none;
      }
    }
  }

  &.half {

    input[type="text"] {

      &:focus ~ .input-border {
        opacity: 1;
        width: 100%;

        &:before,
        &:after {
          width: 100%;
        }
      }
    }

    .input-border {
      opacity: 0;

      &:before, &:after {
        box-shadow: none;
        bottom: 0;
        content: '';
        display: block;
        position: absolute;
        top: 0;
        width: 0;
        transition: ($anim-speed * 2) ease-in-out all;
      }

      &:before {
        border-left: solid $border-width $border-color;
        border-top: solid $border-width $border-color;
        left: 0%;
      }

      &:after {
        border-right: solid $border-width $border-color;
        border-bottom: solid $border-width $border-color;
        right: 0%;
      }
    }
  }

  &.circle {

    input[type="text"] {

      &:focus ~ .input-border {

        &:first-of-type {

          &:before {
            transition: ($anim-speed / 2) ease-in-out all;
            transition-delay: 0s;
            width: $col-12;
          }

          &:after {
            height: $col-12;
            transition: ($anim-speed / 2) ease-in-out all;
            transition-delay: ($anim-speed / 2);
          }
        }

        &:last-of-type {
          background: transparent;

          &:before {
            transition: ($anim-speed / 2) ease-in-out all;
            transition-delay: $anim-speed;
            width: $col-12;
          }

          &:after {
            height: $col-12;
            transition: ($anim-speed / 2) ease-in-out all;
            transition-delay: (($anim-speed / 2) + $anim-speed);
            top: 0
          }
        }
      }
    }

    .input-border {
      bottom: auto;
      height: $col-12;
      width: $col-12;

      &:before,
      &:after {
        background-color: $border-color;
        content: '';
        display: block;
        position: absolute;
      }

      &:first-of-type {

        &:before {
          height: $border-width;
          left: 0;
          top: 0;
          width: 0;
        }

        &:after {
          height: 0;
          right: 0;
          top: 0;
          width: $border-width;
        }
      }

      &:last-of-type {

        &:before {
          background-color: $border-color;
          height: $border-width;
          top: calc(#{$col-12} - #{$border-width});
          right: 0;
          width: 0;
        }

        &:after {
          background-color: $border-color;
          height: 0;
          top: calc(#{$col-12} - #{$border-width});
          left: 0;
          width: $border-width;
        }
      }
    }
  }

  &.just-bottom {

    input[type="text"] {

      &:focus ~ .input-border {
        opacity: 1;
        width: 100%;

        &:before,
        &:after {
          width: 50%;
        }
      }
    }

    .input-border {
      opacity: 0;

      &:before, &:after {
        box-shadow: none;
        bottom: 0;
        content: '';
        display: block;
        position: absolute;
        top: 0;
        width: 0;
        transition: $anim-speed ease-in-out all;
      }

      &:before {
        border-bottom: solid $border-width $border-color;
        left: 50%;
      }

      &:after {
        border-bottom: solid $border-width $border-color;
        right: 50%;
      }
    }
  }

  &.top-bottom {

    input[type="text"] {

      &:focus ~ .input-border {
        opacity: 1;
        width: 100%;

        &:before,
        &:after {
          width: 50%;
        }
      }
    }

    .input-border {
      opacity: 0;

      &:before, &:after {
        box-shadow: none;
        bottom: 0;
        content: '';
        display: block;
        position: absolute;
        top: 0;
        width: 0;
        transition: $anim-speed ease-in-out all;
      }

      &:before {
        border-bottom: solid $border-width $border-color;
        border-top: solid $border-width $border-color;
        border-right: solid 1px $white;
        left: 50%;
      }

      &:after {
        border-bottom: solid $border-width $border-color;
        border-top: solid $border-width $border-color;
        border-left: solid 1px $white;
        right: 50%;
      }
    }
  }

  &.partially {

    input[type="text"] {

      &:focus ~ .input-border {

        &:first-of-type {
          border-left: solid $border-width $border-color;
        }

        &:last-of-type {
          background: transparent;
          border-right: solid $border-width $border-color;
        }

        &:before,
        &:after {
          height: $border-width;
          width: ($col-1 / 2);
        }
      }
    }

    .input-border {
      bottom: auto;
      height: $col-12;
      width: $col-12;

      &:before,
      &:after {
        background-color: $border-color;
        content: '';
        display: block;
        position: absolute;
      }

      &:before {
        top: 0;
      }

      &:after {
        bottom: 0;
        top: auto;
      }

      &:first-of-type {
        left: 0;

        &:before,
        &:after {
          left: 0;
        }
      }

      &:last-of-type {
        right: 0;

        &:before,
        &:after {
          right: 0;
        }
      }
    }
  }

  &.enlarge {

    input[type="text"] {

      &:focus {
        background-color: $white;
        border-color: $border-color;
        border-width: 2px;
        transition: ($anim-speed * 0.5) ease-in-out all;
      }
    }

    .input-border {
      display: none;
    }
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console