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>
	<header>
		<figure class="branding"></figure>
		<nav class="menu--main">
			<ul class="menu">
				<li class="menu-item"><a href="#">Menu Item 1</a></li>
				<li class="menu-item"><a href="#">Menu Item 2</a></li>
				<li class="menu-item"><a href="#">Menu Item 3</a></li>
				<li class="menu-item"><a href="#">Menu Item 4</a></li>
			</ul>
		</nav>
		<div id="block-headermeta">
			<a href="#" id="search"><i class="fa fa-search"></i></a>
		</div>
	</header>
	<div id="full-search-area">
		<div class="searchbar">
			<figure class="searchbar__branding"></figure>
			<div class="searchbar__text">
				<input type="search" class="search-example" placeholder="office chair, places to focus, etc." autofocus />
			</div>
			<div class="searchbar__close">
				<button>&times;</button>
			</div>
		</div>
		<div id="results" class="results">
			<div class="results__product fade-content row">
				<h3 class="col-12">Most Relevant Results</h3>
				<figure class="col-6 col-sm-3">
					<img src="https://picsum.photos/800/450" alt="" class="img-fluid" />
					<figcaption>Rowan</figcaption>
				</figure>
				<figure class="col-6 col-sm-3">
					<img src="https://picsum.photos/800/450" alt="" class="img-fluid" />
					<figcaption>Elani</figcaption>
				</figure>
				<figure class="col-6 col-sm-3">
					<img src="https://picsum.photos/800/450" alt="" class="img-fluid" />
					<figcaption>Lona</figcaption>
				</figure>
				<figure class="col-6 col-sm-3">
					<img src="https://picsum.photos/800/450" alt="" class="img-fluid" />
					<figcaption>All Products</figcaption>
				</figure>
			</div>
			<div class="results__additional row">
				<div class="col-12 col-sm-6 fade-content">
					<h3>Additional Products</h3>
					<ul class="fade-content">
						<li><a href="#">Heya</a></li>
						<li><a href="#">Qove</a></li>
						<li><a href="#">Madrid</a></li>
					</ul>
				</div>
				<div class="col-12 col-sm-6 fade-content">
					<h3>Additional Resources</h3>
					<ul class="fade-content">
						<li><a href="#">Products by designers</a></li>
						<li><a href="#">Downloads</a></li>
						<li><a href="#">Products by application</a></li>
					</ul>
				</div>
			</div>
			<div class="results__cancel">
				<button type="button" id="cancel" class="btn btn-sm btn-secondary">Cancel</button>
			</div>
		</div>
		
	</div>
	<div id="mainpage"></div>
</section>
              
            
!

CSS

              
                // @import "compass";
@import url('https://fonts.googleapis.com/css?family=Montserrat:300,400,700');

// COLOR VARIABLES
$color__primary: #796e65;
$color__primary--light: #aca39a;
$color__primary--lighter: #cbc4bc;
$color__white: #f6f5f4;

// EASY MIXINS
@mixin inline-link() {
	// Body copy links should look like this
	// doesn't have to be a mxin, just seems easier
	position: relative;
	display: inline-block;
	color: inherit;
	text-decoration: none;
	&::after {
		content: "";
		position: absolute;
		top: 100%;
		left: 0;
		background-color: $color__primary--light;
		width: 100%;
		height: 1px;
		margin: 0 auto;
		opacity: 0.33;
		transform: scaleX(0.9);
		transform-origin: left;
		transition: opacity 150ms, transform 150ms;
	}
	&:hover,
	&:focus {
		color: inherit;
		text-decoration: none;
		&::after {
			opacity: 1;
			transform: scaleX(1);
		}
	}
}
@mixin body-copy() {
	font-weight: 300;
	widows: 3;
	orphans: 3;
}

body {
	color: $color__primary;
}

.main-title {
	font-size: 54px;
	font-weight: 700;
}

h1, h2, h3, h4, h5, h6 {
	margin-bottom: .75em;
}

p {
	@include body-copy();
	a {
		@include inline-link();
	}
}

b, strong { font-weight: 700; }
i, em { font-weight: 300; }

ul, ol, dl {
	@include body-copy();
}

.menu--main {
	// fade out
	.menu-item {
		opacity: 1;
		transform: translateY(0);
		transition: 150ms;
		&.exiting { // fade menu items down
			opacity: 0;
			transform: translateY(30px);
		}
	}
	// small color fade decoration
	// should probably be added to larger parent if at all
	.menu-item a {
		transition: 150ms; // or whatever is default
	}
	&:hover {
		.menu-item a {
			color: $color__primary--lighter;
			&:hover { color: $color__primary; }
		}
	}
}

#full-search-area {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: none;
	background-color: fade-out(#000, 0.5);
	z-index: 500;
	.searchbar {
		position: relative;
		background-color: #fff;
		width: 100%;
		height: 85px;
		padding: 20px 30px;
		&__branding {
			height: 85px;
		}
		&__text {
			position: absolute;
			top: 0;
			left: 150px;
			right: 85px;
			display: inline-block;
			height: 85px;
			[type="search"] {
				display: block;
				color: inherit;
				border: 0;
				font-size: 1.5em;
				font-weight: 300;
				height: 100%;
				width: 100%;
				padding: 0;
				padding-right: 30px;
				appearance: none !important;
				&:focus {
					outline: 0;
				}
				&::placeholder {
					color: $color__primary--lighter;
				}
			}
			
			// fade in
			opacity: 0;
			transform: translateX(30px);
			transition: 300ms;
			transition-delay: 150ms;
			&.fade-left {
				opacity: 1;
				transform: translateX(0);
			}
		}
		&__close {
			position: absolute;
			top: 0;
			right: 0;
			height: 85px;
			padding-top: 20px;
			padding-right: 30px;
			button {
				appearance: none;
				color: $color__primary--lighter;
				border: 0;
				background: none;
				font-size: 2em;
				padding: 0;
				margin: 0;
				transition: 150ms;
				&:hover,
				&:focus {
					color: $color__primary;
				}
			}
		}
	}
	.results {
		// display: none;
		position: relative;
		background-color: #fff;
		margin: 1px auto 0;
		padding: 30px;
		width: 75%;
		max-width: 1024px;
		opacity: 0;
		transform: translateY(30px);
		transition: all 300ms;
		&.fading {
			opacity: 1;
			transform: translateY(0);
		}
		h3 {
			color: $color__primary--lighter;
			font-size: .75em;
			font-weight: 700;
			text-transform: uppercase;
		}
		ul {
			margin: 0;
			padding: 0;
			list-style: none;
			li {
				margin-bottom: 3px;
				a {
					@include inline-link();
					font-size: 1.5em;
				}
			}
		}
		&__product {
			figure {
			}
			figcaption {
				font-weight: 700;
				text-align: center;
			}
		}
		&__additional {
			margin-bottom: 1.5em;
		}
	}
}

.fade-content > * {
	opacity: 0;
	transform: translateY(30px);
	transition: opacity 50ms, transform 300ms;
	&:nth-of-type(2) { transition-delay:  50ms; }
	&:nth-of-type(3) { transition-delay: 100ms; }
	&:nth-of-type(4) { transition-delay: 150ms; }
	&:nth-of-type(5) { transition-delay: 200ms; }
	.fading & {
		opacity: 1;
		transform: translateY(0);
	}
}

// DEMO ONLY

body {
	background-color: $color__white;
	font-family: Montserrat;
	margin: 2em;
}

* {
	box-sizing: border-box;
}

#search {
	color: $color__primary--light;
	&:hover,
	&:focus {
		color: $color__primary;
	}
}

section {
	position: relative;
	background-color: #fff;
	border-radius: 6px;
	box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
	max-width: 1440px;
	margin: 0 auto;
}

header {
	position: relative;
	width: 100%;
	height: 85px;
	padding: 20px 30px;
	border-bottom: 1px $color__white solid;
	.branding {
		display: inline-block;
		background-color: $color__white;
		width: 100px;
		height: 100%;
		margin: 0;
	}
	.menu--main {
		display: inline-block;
		margin-right: 20px;
		.menu {
			position: absolute;
			top: 0;
			height: 85px;
			line-height: 85px;
			margin: 0 0 0 20px;
			padding: 0;
			&-item {
				display: inline-block;
				font-size: 1em;
				text-transform: uppercase;
				height: 85px;
				margin: 0;
				margin-right: 28px;
				padding: 0;
				a {
					color: $color__primary;
					font-size: 11px;
					font-weight: 700;
					text-decoration: none !important;
					letter-spacing: .033rem;
				}
			}
		}
	}
	#block-headermeta {
		position: absolute;
		top: 0;
		right: 30px;
		line-height: 85px;
		height: 85px;
		z-index: 400;
	}
}

#full-search-area {
	.searchbar__branding {
		display: inline-block;
		background-color: $color__white;
		width: 100px;
		height: 100%;
		margin: 0;
	}
}

#mainpage {
	background-color: $color__primary--lighter;
	width: 100%;
	min-height: 500px;
	border-bottom-left-radius: 6px;
	border-bottom-right-radius: 6px;
}
              
            
!

JS

              
                $(document).ready(function() {
	
	$('#search').on('click touchstart', function() {
		$('#full-search-area, #resultsToggle').fadeIn(150);
		$('.menu--main .menu-item').addClass('exiting');
		$('.searchbar__text').addClass('fade-left');
		$('input.search-example').focus();
	});
	
	function checkForInput(element) {
		if ($(element).val().length > 0) {
			$('#results').addClass('fading');
		} else {
			$('#results').removeClass('fading');
		}
	}
	$('input.search-example').each(function() {
		checkForInput(this);
	});
	$('input.search-example').on('change keyup', function() {
		checkForInput(this);
	});
	
	$('.searchbar__close button, #cancel').on('click touchstart', function() {
		$('#full-search-area').fadeOut(150);
		$('.searchbar__text').removeClass('fade-left');
		$('.menu--main .menu-item').removeClass('exiting');
	});

});
              
            
!
999px

Console