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 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

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

              
                <div class="container">
	<div class="input">
		<input class="input-control" type="email" name="email" placeholder="Email" id="email" autocomplete="off" required />
		<label class="input-label" for="email">Email</label>
		<label class="input-back" for="email"></label>
	</div>
</div>
              
            
!

CSS

              
                $goldenRatio: 1.618

$input-color-background: #F5F5F5
$input-color-label-empty: #4A4A4A
$input-color-label-filled: #9B9B9B
$input-color-label-disabled: lighten($input-color-label-empty, 20)
$input-color-control: $input-color-label-empty
$input-color-control-disabled: $input-color-label-disabled
$input-color-selection-background: $input-color-control
$input-color-selection-font: $input-color-background
$input-color-error: #FF6666
$input-duration-focus: .3s
$input-lineHeight: 1em * $goldenRatio
$input-label-scaleFactor: 1 / $goldenRatio
$input-height: 2 * $input-lineHeight
$input-padding-horizontal: ($input-height - $input-lineHeight) / 2


.input
	height: $input-height
	position: relative
	display: flex
	align-items: center
	font-family: 'Open Sans', sans-serif
	font-size: 1em

	&-control,
	&-label
		height: $input-lineHeight
		line-height: $input-lineHeight
		font-size: inherit

		&::selection
			color: $input-color-selection-font
			background: $input-color-selection-background

	&-control
		color: $input-color-control
		position: relative
		flex: 1
		z-index: 2
		padding: 0 0 0 $input-padding-horizontal
		transition: transform $input-duration-focus
		background: transparent
		border: none

		// We have our own focus effect
		&:focus 
			outline: none

		// Hack: disable the yellow webkit auto-fill background
		&:-webkit-autofill
			-webkit-box-shadow: 0 0 0 60em $input-color-background inset !important
			&,
			&:hover,
			&:focus,
			&:active
				transition-delay: 9999s
				transition-property: background-color, color

	&-label
		position: absolute
		top: 50%
		right: 0
		bottom: 0
		left: $input-padding-horizontal
		z-index: 1
		display: none // Hide this for old browsers
		transition-duration: $input-duration-focus
		transition-property: transform, color
		transform-origin: top left
		pointer-events: none
		text-align: left

	&-back,
	&-label
		margin: 0

	&-back
		position: absolute
		top: 0
		right: 0
		bottom: 0
		left: 0
		z-index: 0
		background: $input-color-background

		// Fake border using box-shadow. We animate its opacity (as opposed to the shadow itself) for performance reasons.
		&::before
			position: absolute
			top: 0
			right: 0
			bottom: 0
			left: 0
			content: ''
			display: block
			opacity: 0
			box-shadow: 0 0 0 .125em darken($input-color-background, 10)
			transition: opacity $input-duration-focus

	> *
		cursor: text

	&-control:focus ~ &-back::before
		opacity: 1

	&-control[disabled]
		color: $input-color-control-disabled
	&-control[disabled] ~ &-label
		color: $input-color-label-disabled
	&-control[disabled],
	&-control[disabled] ~ &-label,
	&-control[disabled] ~ &-back
		cursor: not-allowed

	// #### The trick ####

	// We rely on the actual placeholder in old browsers so we set its color
	&-control::placeholder
		color: $input-color-label-empty

	// But override it in newer browsers
	&-control:placeholder-shown::placeholder
		color: transparent

	// Make the first selector invalid in older browsers & match nothing in newer
	// Apply the second in browsers that support :placeholder-shown
	\:not(*):placeholder-shown,
	&-label
		display: block
		transform: translateY(-100% * $input-label-scaleFactor) scale($input-label-scaleFactor)
		color: $input-color-label-empty

	&-control:placeholder-shown ~ &-label
		transform: translateY(-50%)
		color: $input-color-label-filled

	&-control:placeholder-shown
		transform: translateY(0)

	\:not(*):placeholder-shown,
	&-control
		transform: translateY(50% * $input-label-scaleFactor)


	// Firefox-only validation:
	&-control:-moz-ui-invalid
		box-shadow: none
	&-control:-moz-ui-invalid ~ &-back::before
		box-shadow: 0 0 0 .125em $input-color-error
		opacity: 1
	&-control:-moz-ui-invalid:focus ~ &-back::before
		box-shadow: 0 0 0 .125em darken($input-color-error, 8)



// General styles
.container
	max-width: 30em
	margin: 2em auto

              
            
!

JS

              
                
              
            
!
999px

Console