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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ 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

              
                -var content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pellentesque mi sit amet sagittis eleifend. Duis dignissim, sem et facilisis sagittis, lectus risus tempor ex, congue aliquet sapien ante eget est. Morbi posuere rutrum sem eu tincidunt. Integer vehicula, tortor eu interdum efficitur, mauris turpis scelerisque nisl, et varius ante leo quis libero. Morbi sit amet venenatis quam, eget pulvinar neque. Donec vitae fringilla odio. Quisque ultrices neque et enim mollis, a tempus tortor accumsan. Aliquam erat volutpat. et condimentum ligula. Fusce tincidunt interdum ligula, tristique tempus massa tincidunt eget. Cras consequat, ipsum ac ultrices imperdiet, ligula tellus hendrerit dui, ac euismod quam quam vitae diam. Nulla rhoncus ac ante quis placerat. Phasellus quis mauris sit amet magna egestas imperdiet. Etiam imperdiet velit eget ante consequat tempus. Suspendisse at eros vitae orci lobortis porttitor eget a lacus. Sed est metus, efficitur et faucibus pulvinar, tempor sed odio. Fusce turpis mi, ornare ut vestibulum et, aliquam non dui. Fusce auctor erat nec augue pharetra, quis laoreet erat condimentum. Ut egestas sed tortor at eleifend. vitae tincidunt purus. Suspendisse condimentum maximus sodales. Suspendisse sed dolor quis enim dictum maximus sit amet vitae elit. Nunc interdum, augue id sollicitudin porta, ligula dolor sollicitudin sem, in mollis sem urna eget purus. Vivamus et auctor mauris, et lacinia enim. Sed non dolor pellentesque, commodo nisi et, molestie arcu. Aenean nec ullamcorper tortor. Curabitur in odio massa. Maecenas accumsan lacinia est, at semper quam aliquet sit amet."


nav.normal
	a(href="#one") Item One
	a(href="#two") Item Two
	img(src="https://avatars1.githubusercontent.com/u/13227184" alt="adcar logo")
	a(href="#three") Item Three
	a(href="#four") Item Four
header
	h1 Super important title
	span And a semi-important subtitle
main
	h2 Introduction
	p= content
	
	h2#one Item One
	p= content
	
	h2#two Item Two	
	p= content
	
	h2#three Item Three
	p= content
	
	h2#four Item Four
	p= content
              
            
!

CSS

              
                :root {
	--tran: all 0.5s ease-out;
	--tran-short: all 0.25s ease-out;
	--shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
html,
body {
	height: 100%;
	font-family: Poppins;
	background-color: white;
}
h1, 
h2 {
	text-transform: uppercase;
}
p {
	line-height: 1.5em;
}
h1 {
	margin-bottom: 5px;
}
header {
	background-image: linear-gradient(rgba(0,0,0,0.6), rgba(0,0,0,0.6), rgba(0,0,0,0.3)), url('https://images.unsplash.com/photo-1502428095540-e2ab9eca7aa0?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=e5cf0b89f882e41f2efe64ab50f438d0');
	background-position: top;
	background-size: cover;
	background-attachment: fixed;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	font-size: 3em;
	color: white;
	text-transform: uppercase;
	h1,
	span {
		text-align: center;
	}
}

main {
	max-width: 50em;
	margin: 0 auto;
	padding: 3em 1em;
	h2 {
		font-size: 36pt;
	}
}

nav {
	padding: 1.5em 0.5em;
	transition: var(--tran);
	position: fixed;
	top: 0;
	left: 0;
	height: 80px;
	width: 100%;
	display: flex;
	justify-content: space-around;
	align-items: center;
	a {
		padding: 1em 2em;
		transition: var(--tran-short);
		text-transform: uppercase;
		text-decoration: none;
	}
	img {
		transition: var(--tran);
		height: 70px;
		width: 70px;
		border-radius: 50%;
		padding: 1em;
	}
}
nav.normal {
	background-color: transparent;
	a {
		color: white;
		&:hover {
			color: black;
			background-color: white;
		}
	}
	img {
		box-shadow: var(--shadow);
		background-color: white;
	}
}
nav.inverse {
	box-shadow: var(--shadow);
	background-color: white;
	a {
		color: black;
		&:hover {
			background-color: black;
			color: white;
		}
	}
	img {
		background-color: transparent;
	}
}
nav.small {
	height: 20px;
	img {
		height: 50px;
		width: 50px;
	}
}
              
            
!

JS

              
                let nav = document.querySelector('nav')

window.addEventListener('scroll', () => {
	if (window.scrollY > 20) {
		nav.className = 'inverse'
	} else {
		nav.className = 'normal'
	}
	if (window.scrollY > 200) {
		nav.classList.add('small')
	} else {
		nav.classList.remove('small')
	}
})


document.querySelectorAll('nav a').forEach(item => item.addEventListener('click', e => {
	e.preventDefault()
	
	let href = item.getAttribute('href')
	
	document.querySelector(href).scrollIntoView({behavior: 'smooth'})
}))
              
            
!
999px

Console