cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <header>
  <h1><i class="fa fa-cloud"></i> Floated Labels! <span>with Forms</span> <i class="fa fa-cloud"></i></h1>
  <p>Floated labels allow us to design cleaner forms, in addition to adding some nice interaction!</p>
  <h3>Follow me <i class="fa fa-twitter"></i> <a href="https://twitter.com/soulrider911" target="_blank">  @soulrider911</a></h3>
</header>
<form action="">
  <!--  General -->
  <div class="form-group">
    <h2 class="heading">General</h2>
    <div class="controls">
      <input type="text" id="name" class="floatLabel" name="name">
      <label for="name">Name</label>
    </div>
    <div class="controls">
      <input type="email" id="email" class="floatLabel" name="email">
      <label for="email">Email</label>
    </div>
  </div>
  <!--  Details -->
  <div class="form-group">
    <h2 class="heading">Details</h2>
    <div class="controls">
      <input type="tel" id="cell" class="floatLabel" name="cell">
      <label for="cell">Celly</label>
    </div>
    <div class="controls">
      <i class="fa fa-sort"></i>
      <select class="floatLabel">
        <option value="blank"></option>
        <option value="Apple">Apple</option>
        <option value="Banana">Banana</option>
        <option value="Kiwi">Kiwi</option>
        <option value="Orange">Orange</option>
        <option value="Watermelon">Watermelon</option>
      </select>
      <label for="fruit">Favotire Fruit</label>
    </div>
  </div>
  <!--  More -->
  <div class="form-group">
    <h2 class="heading">More!</h2>
    <div class="controls">
      <textarea name="comments" class="floatLabel" id="comments"></textarea>
      <label for="comments">Comments</label>
      <button>Submit</button>
    </div>
  </div>
</form>
            
          
!
            
              @import "compass/css3";

@import "compass/reset";
@import "compass/css3";

/* Colors */	
/* ---------------------------------------- */ 
$border: 		#c6c6c6;
$border-focus: 	#9FB1C1;
$blue: 			#077ABC;
$aqua: 			#07B3A1;
$asphalt: 		#506982;

*{
	@include box-sizing(border-box);
}
body{
	text-align: center;
	font-family: 'Lato', 'sans-serif';
	font-weight: 400;

}
a{
  text-decoration: none;
}
header, form{
	padding: 4em 10%;
}

header{
	background-color: $blue;
	color: white;
	h1{
		font-weight: 400;
		text-transform: uppercase;
		font-size: 50px;
		margin-bottom: 10px;
    i{
      color: darken($blue, 10%);
    }
		span{
			font-weight:300;
		}
	}
	p{
		font-weight: 400;
		font-size: 16px;
		color: rgba(255,255,255,.9);
     letter-spacing: .05em;
     margin-bottom: 10px;
	}
  h3, 
  h3 a{
    color: #32CCFE;
    a{
      @include transition(color .3s);
      &:hover{
        color: white;
      }
    }
  }
}
.form-group{
	margin-bottom: 20px;
}
h2.heading{
	font-size: 18px;
	text-transform: uppercase;
	font-weight: 300;
	text-align: left;
	color: $asphalt;
	border-bottom: 1px solid $asphalt;
	padding-bottom: 3px;
	margin-bottom: 20px;
}
.controls{
	text-align: left;
	position: relative;
	input[type="text"],
	input[type="email"],
	input[type="tel"],
	textarea,
	button,
	select{
		padding: 12px;
		font-size: 14px;
		border: 1px solid $border;
		width: 100%;
		margin-bottom: 18px;
		color: #888;
		font-family: 'Lato', 'sans-serif';
		font-size: 16px;
		font-weight: 300;
     background-color: #fff;
		@include border-radius(2px);
		@include transition(all .3s);

		&:focus, &:hover{
			outline: none;
			border-color: $border-focus;
			+ label{
				color: $blue;
          cursor: text;
			}
		}
	}
	.fa-sort{
		position:absolute;
		right: 10px;
		top: 17px;
		color: #999;
	}
	select{
		@include appearance(none);
		cursor: pointer;
	}
	label{
		position: absolute;
		left: 8px;
		top: 12px;
		color: #999;
		font-size: 16px;
		display: inline-block;
		padding: 4px 10px;
		font-weight: 400;
		background-color: rgba(255,255,255,0);
    pointer-events: none;
		@include transition(color .3s, top .3s, background-color .8s);
		&.active{
			top: -11px;
			color: #555;
       background-color: rgba(255,255,255,1);
		}
	}
	textarea{
		resize: none;
		height: 200px;
	}
	button{
		cursor: pointer;
		background-color: $aqua;
		border: none;
		color: #fff;
		padding: 12px 0;
		&:hover{
			background-color: lighten($aqua, 5%);
		}
	}
}

            
          
!
            
              (function($){
	function floatLabel(inputType){
		$(inputType).each(function(){
			var $this = $(this);
			// on focus add cladd active to label
			$this.focus(function(){
				$this.next().addClass("active");
			});
			//on blur check field and remove class if needed
			$this.blur(function(){
				if($this.val() === '' || $this.val() === 'blank'){
					$this.next().removeClass();
				}
			});
		});
	}
	// just add a class of "floatLabel to the input field!"
	floatLabel(".floatLabel");
})(jQuery);
            
          
!
999px
Loading ..................

Console