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

              
                #search
	input#input(placeholder="Search...")
	button#button: i.fa.fa-search
	.spinner: i.fa.fa-spinner
	
.note Click the button or hit enter.
              
            
!

CSS

              
                $color: #974fe4
$color-dark: darken(desaturate($color, 10), 5)
$font-size: 30px
$icon-size: 30px
$width-input: 500px
$border-radius: 10px
$transition: all 0.5s

// Reset
*
	box-sizing: border-box
	margin: 0
	padding: 0
	-webkit-font-smoothing: antialiased


// Rules

body
	align-items: center
	background: $color
	color: #fff
	display: flex
	font: #{$font-size}/1.375 'Lato', arial, sans-serif
	flex-flow: column nowrap
	height: 100vh
	justify-content: center
	width: 100vw

.note
	font-size: 0.375em
	font-weight: bold
	text-transform: uppercase
	color: darken($color-dark, 15)

#search
	align-items: center
	background: $color-dark
	border-radius: $border-radius
	display: flex
	justify-content: space-between
	margin: 0.5em 0
	padding: 0.5em 0.5em 0.5em 1em
	transition: $transition
	width: $width-input

	&:hover,
	&:focus
		background: darken($color-dark, 2)
	
	button,
	input
		appearance: none
		background: transparent
		border: 0
		color: inherit
		font: inherit
		outline: 0

	button
		cursor: pointer
		padding: 0 0.25em

	input
		flex: 1

		&::placeholder
			color: #fff

	.spinner
		animation: spinner 1s infinite linear
		display: none
		padding: 0 0.25em
		
#search.loading
	button
		display: none

	.spinner
		display: block


// Animation

@keyframes spinner
	0%
		transform: rotate(0deg)

	100%
		transform: rotate(360deg)
              
            
!

JS

              
                var search = document.getElementById('search');
var button = document.getElementById('button');
var input = document.getElementById('input');

function loading() {
	search.classList.add('loading');
	
	setTimeout(function() {
		search.classList.remove('loading');
	}, 1500);
}

button.addEventListener('click', loading);

input.addEventListener('keydown', function() {
	if(event.keyCode == 13) loading();
});
              
            
!
999px

Console