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.

		<button aria-controls="nav-collapsible" hidden="">Menu</button>
		<div id="nav-collapsible">
				<li><a href="">Hamburg-Mitte</a></li>
				<li><a href="">Altona</a></li>
				<li><a href="">Eimsbüttel</a></li>
				<li><a href="">Hamburg-Nord</a></li>
				<li><a href="">Wandsbek</a></li>
				<li><a href="">Bergedorf</a></li>
				<li><a href="">Harburg</a></li>
<main id="main">
	<p>Claudius Ptolemy (2nd century AD) reported the first name for the vicinity as Treva.</p>
	<p>The name Hamburg comes from the first permanent building on the site, a castle which the Emperor Charlemagne ordered constructed in AD 808. It rose on rocky terrain in a marsh between the River Alster and the River Elbe as a defence against Slavic incursion, and acquired the name Hammaburg, burg meaning castle or fort. The origin of the Hamma term remains uncertain, as does the exact location of the castle.</p>
	<footer>(Source: Wikipedia)</footer>

              * { box-sizing: border-box }

	background: black;

	margin: auto;
	max-width: 24em;
	min-height: 100vh;
	background: white;
	position: relative;
	font-family: Source Sans Pro, Open Sans, Calibri, sans-serif;

	padding: 1em;
	display: flex;
	flex-flow: row wrap;
	justify-content: space-between;
	align-items: center;
	background: #da121a;
	color: white;

	font: inherit;
	color: currentcolor;
	border: thin solid;
	border-radius: 0.25em;
	padding: 0.5em 2em;
	background: transparent url( 0.5em center / auto 80% no-repeat;
	position: relative;

	content: '▶︎';
	position: absolute;
	right: 1em;
	bottom: 0.9em;
	font-size: 0.7em;

	content: '▼'

	position: absolute;
	top: var(--page-header-height);
	right: 0;
	bottom: 0;
	left: 0;
	background: hsl(0deg 0% 95%);
	color: black;
	transition: 0.1s transform ease-in-out;
	transform-origin: right;

	display: block !important;
	transform: scaleX(0);

nav ul
	list-style: none;
  list-style: url("data:image/svg+xml,%3Csvg xmlns=''/%3E"); /* Safari hack, see */
	margin: 0;
	padding: 0;

nav li:not(:last-child)
	border-bottom: thin solid silver;

nav a
	display: block;
	padding: 0.5em 1em;
	color: currentcolor;
	text-decoration: none;

	background-color: black !important;
	color: white !important;

	padding: 1em;
	max-width: 42em;

              const collapsibleElement = document.querySelector('#nav-collapsible');
collapsibleElement.controlElement = document.querySelector('[aria-controls="nav-collapsible"]');

collapsibleElement.toggle = (event, force) => {
	const isToBeVisible = force !== undefined ? force : collapsibleElement.hidden;
	collapsibleElement.hidden = !isToBeVisible;
	collapsibleElement.setAttribute('aria-hidden', !isToBeVisible);
	collapsibleElement.controlElement.setAttribute('aria-expanded', isToBeVisible);
	if (!isToBeVisible)

collapsibleElement.close = event => collapsibleElement.toggle(event, false); = event => collapsibleElement.toggle(event, true);


collapsibleElement.controlElement.hidden = false;

collapsibleElement.controlElement.addEventListener('click', collapsibleElement.toggle);

document.documentElement.addEventListener('click', event => {
	if ( !== collapsibleElement.controlElement && !'#nav-collapsible'))

document.documentElement.addEventListener('keyup', event => {
	if (event.code === 'Escape')

const pageHeaderElement = document.querySelector('header');
pageHeaderElement.setHeightCustomProperty = () => {
	if (window.CSS && CSS.supports && CSS.supports('--page-header-height: 0'))
	{'--page-header-height', `${pageHeaderElement.offsetHeight}px`);
		document.querySelector('#nav-collapsible').style.setProperty('top', `${pageHeaderElement.offsetHeight}px`);

window.addEventListener('load', pageHeaderElement.setHeightCustomProperty);
window.addEventListener('resize', pageHeaderElement.setHeightCustomProperty);
🕑 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.