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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

              <h1>Infield Top Aligned Form Labels</h1>

						<input id="first-name" type="text" />
						<label for="first-name">First Name</label>
						<input id="last-name" type="text" />
						<label for="last-name">Last Name</label>
						<input id="email" type="text" />
						<label for="email">Email</label>
						<input id="spirit-animal" type="text" />
						<label for="spirit-animal">Spirit Animal</label>

<p>Quick demo for <a href="http://uxmovement.com/forms/why-infield-top-aligned-form-labels-are-quickest-to-scan">this article</a></p>
              $color  : #888888;
$bgColor: #fffdfa;
$fontFamily: "Lucida Grande", "Trebuchet MS", sans-serif;

form, ul, li, input, label {
	box-sizing: border-box;
	display: block;

ul {
	background-color: $bgColor;
	border: 5px solid $color;
	list-style-type: none;
	margin: 3em auto;
	padding: 0;
	width: 350px;

li {
	border-bottom: 1px solid lighten($color, 25);
	margin-top: -1px; // border collapser
	position: relative;

label, input {
	transition: color 0.4s ease, background-color 0.1s ease-in-out;

label {
	// labels are after the input in the HTML...
	color: lighten($color, 15);
	font-family: $fontFamily;
	font-size: 70%;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	// ... move it up top ...
	position: absolute;
	top: 10px;
	left: 10px;
	// ... so that we can use a sibling selector.
	input:focus+& {
		color: darken(#0074D9, 10);
		font-weight: bold;
		letter-spacing: -0.01em;

input {
	background-color: transparent;
	border: none;
	color: darken($color, 15);
	font-size: 18px;
	margin: 9px 0 7px 0;
	margin: 0;
	padding: 2em 10px 10px 10px;
	outline: none;
	width: 100%;
		&:focus {
			color: #000;
			background-color: lighten($color, 40);
			box-shadow: 0px 3px 4px -2px rgba(0,0,115,0.25) inset;

// codepen wrapper
html {
	min-height: 100%;
body {
	background-color: #ddd;
	background-image: linear-gradient(to bottom, #f3f3f3 50%  , #acacac 90%);
	//color: $color;
	//font-family: Helvetica, Arial, sans-serif;
	font-size: 16px;
	padding: 20px;	
h1, p {
	color: #333;
	font-family: $fontFamily;
	font-size: 1.6em;
	margin: 0.5em 0 1em 0;
	text-align: center;
p {
	font-size: 80%;
Loading ..................