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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              header.header: button.toggle
		.bars
			- let bars = 3;
			while bars--
				span.bar
nav.navigation: ul.list
		- let items = ['About', 'Stories', 'Contact'];
			each item in items
				li.item: a.link(href="#"): span.link-text= item
main.content
	article.article
		h1.title Bear Costume
		.details
			| by 
			a(href="http://fictionaut.com/users/steven-miller") Steven Miller
		p.body He ran over our elderly neighbor Lenard, but not on purpose, or at least not as far as we could tell; there wasn't any yelling, I mean, and he didn't look happy when he got out of the car, though who could really tell through a bear costume. For all we knew, he had left on the bear hat -- that's what it was, a kind of all-inclusive hat -- just long enough to let a victorious smirk melt from his face. Or maybe it really was an accident. A practical joke, even, meant to inspire the neighborhood children to look on in wonder and tell their mothers, "Look, Mama, a bear driving a sedan. Isn't that silly?" And I think we can all relate to that, to the practical joke that went too far and practically killed our best friend, baby sister, elderly neighbor. And then Lenard was breathing again and we stopped wondering all together.
            
          
!
            
              .header {
	height: 45px;
	position: fixed;
	width: 100%;
}

.toggle {
	background-color: transparent;
	border: 0;
	height: 45px;
	outline: none;
	padding: 10px;
	position: relative;
	width: 45px;
}

.bars {
	left: 50%;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
}

.bar {
	background-color: #ffffff;
	display: block;
	height: 2px;
	margin: 0 0 6px 0;
	transition: all 0.3s;
	width: 30px;
}
.bar:last-child {
	margin: 0;
}
.is-active .bar:nth-child(1) {
	transform: translateY(3px) rotate(45deg);
}
.is-active .bar:nth-child(2) {
	display: none;
}
.is-active .bar:nth-child(3) {
	transform: translateY(-4px) rotate(-45deg);
}

.navigation {
	position: fixed;
	top: 45px;
	transform: translateY(-1000%);
	transition: all 0.5s;
	width: 100%;
}
.navigation.is-active {
	transform: translateY(0);
	transition: all 0.2s;
	transition-delay: 0.5s;
}

.list {
	display: flex;
	list-style-type: none;
	margin: 0;
	padding: 0;
}

$itemNumber: 3;

.item {
	flex: 1 1 auto;
	transform: translateY(-100px);
	transition: all 0.3s ease-in;
}
.is-active .item {
	$itemNumber: 3;
	$i: 1;
	@while $i <= $itemNumber {
		&:nth-child(#{$i}) {
			transform: translateY(0);
			transition: all 0.3s ease-out;
			transition-delay: 0.25s * $i;
		}
		$i: $i + 1;
	}
}

.link {
	color: #ffffff;
	display: block;
	font-size: 3em;
	font-weight: 900;
	text-align: center;
	text-decoration: none;
}

.link-text {
	border-bottom: 5px solid white;
}

.content {
	min-height: 100%;
	transition: all 0.5s cubic-bezier(0.78, 0.24, 0.96, 0.69);
	transform-origin: 50% 100%;
	padding: 2em;
}
.content.is-inactive {
	filter: blur(1px);
	opacity: 0.3;
	transform: rotateX(20deg);
	transform-origin: 50% 100%;
	transition: all 0.5s cubic-bezier(0.78, 0.24, 0.96, 0.69);
}

.article {
	color: #ffffff;
	margin: 0 auto;
	width: 60%;
}

.title {
	margin-bottom: 5px;
}

.details {
	font-size: 0.75em;
}
.details a {
	color: #ffffff;
}

.body {
	line-height: 24px;	
}

// --------

@import url('https://fonts.googleapis.com/css?family=Open+Sans');

*,
*::after,
*::before {
	box-sizing: border-box;
}

body {
	background-color: #000000;
	font-family: 'Open Sans';
	perspective: 800px;
}
body.is-inactive {
	overflow: hidden;
}

html,
body {
	height: 100%;
}
            
          
!
            
              const content = document.querySelector('.content');
const navigation = document.querySelector('.navigation');
const toggle = document.querySelector('.toggle');
const body = document.querySelector('body');

toggle.addEventListener('click', (e) => {
	toggle.classList.toggle('is-active');
	navigation.classList.toggle('is-active');
	content.classList.toggle('is-inactive');
	body.classList.toggle('is-inactive');
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console