css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

              <nav id="menu">
	<ul id="menu-closed">
		<li><a href="#">Start</a></li>
		<li><a href="#">Events</a></li>
		<li><a href="#">Calendar</a></li>
		<li><a href="#">Portfolio</a></li>
		<li><a href="#">Blog</a></li>
		<li><a href="#">Products</a></li>
		<li><a href="#">Things</a></li>
		<li><a href="#">About</a></li>
		<li><a href="#">Contact</a></li>
		<li><a href="#">Login</a></li>
		<li><a href="#menu-closed">&#215; Close</a></li>
		<li><a href="#menu">&#9776; Menu</a></li>
<h1>CSS only priority navigation</h1>
<p>Resize this window and watch the navigation adapt to available space. <strong>No JS</strong>. <strong>Only CSS</strong>. A pen by <a href="https://codepen.io/olach">Ola</a>.</p>
              * {margin: 0; padding:0;}
*,*::before, *::after {
	box-sizing: inherit;
html {
	box-szing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
	background: #fafafa;
	padding: 0 2rem 2rem;
	color: #223;

nav {
	font-size: 12px;
	box-shadow: 0 1px 2px rgba(19, 51, 61, 0.5);
	margin: 0 0 3rem;
	padding: 0 0 0 1em;
	height: 75px; /* Menu height */
	overflow: hidden; /* Don't show anything outside the nav */

nav ul {
	margin: 0;
	padding: 0;
	list-style-type: none;
	max-height: 150px; /* Menu height x 2 */
	position: relative; /* Position the menu button relative to this item */
	text-align: center;

nav li {
	display: inline-block;
nav li:hover {

nav a {
	background-color: #FFF;
	display: block;
	padding: 0 1em;
	color: #444;
	font-weight: 700;
	letter-spacing: 2px;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	line-height: 75px; /* Menu height */
	height: 75px; /* Menu height */
nav a:hover {
	background-color: rgba(162,242,156, 1);

nav li:last-child { /* The menu button */
	position: absolute; /* Move the menu button out of flow */
	right: 0;
	bottom: 75px; /* Move upwards, the same distance as the menu height */
	background: #fff;
	box-shadow: -.2rem 0 .5rem rgba(0,0,0,.7), -.4rem 0 .5rem rgba(0,0,0,.3);
	padding: 0 1em;

nav li:nth-last-child(2) { /* The close button */
	display: none;

#menu:target {
	height: auto;
	padding: 0;
	overflow: visible;
	box-shadow: 0 0;

#menu:target ul {
	max-height: 10vh;
	height: auto;
	text-align: left;

#menu:target li {
	display: block;
#menu:target a {
	color: #fff;
	display: block;
	height: 3rem;
	line-height: 3rem;
	transition: .4s

#menu:target a:hover {
	background-color: rgba(162,242,156, .5);
	color: #444;
	text-indent: 2rem;

#menu:target li:last-child {
	display: none;

#menu:target li:nth-last-child(2) {
	background: #fff;
	position: absolute;
	top: 0;
	right: -2px;
	margin: 0;
#menu:target li:nth-last-child(2) a {
	background: inherit;
	color: #FE7867;
#menu:target ~ * {
	display: none;
              /* No JS needed :) */
🕑 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.
Loading ..................