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

              
                <h1>Bertie's <span>Big</span> Burgers</h1>
<div id="menu-icon">☰</div>
<nav class="menu">
	<span id="close">X</span>
	<ul>
		<li>Locations & Hours
			<ul class="sub-menu">
				<li>New York City</li>
				<li>Chicago</li>
				<li>San Francisco</li>
				<li>Los Angeles</li>
				<li>Philadelphia</li>
				<li>Toronto</li>
				<li>Vancouver</li>
			</ul>
		</li>
		<li>Menu
			<ul class="sub-menu grid-2">
				<li>Burgers
					<ul>
						<li>The Big Cheese</li>
						<li>The Big Veg</li>
						<li>The Double Big-Big</li>
						<li>The Big Boss</li>
						<li>The Little Big</li>
					</ul>
				</li>
				<li>Fries
					<ul>
						<li>Classic Fries</li>
						<li>Seasoned Fries</li>
						<li>Curly Fries</li>
						<li>Tater Tots</li>
					</ul>
				</li>
				<li>Salads
					<ul>
						<li>The Big 'Burg</li>
						<li>The Big Ceasar</li>
						<li>The Giant Garden</li>
					</ul>
				</li>
				<li>Shakes
					<ul>
						<li>Big Vanilla</li>
						<li>Big Chocolate</li>
						<li>Big Strawberry</li>
						<li>Big Cookies & Creme</li>
					</ul>
				</li>
			</ul>
		</li>
		<li>Takeout & Delivery</li>
		<li>Catering</li>
		<li>Join the Big Burger Club</li>
	</ul>
</nav>
<section class="article">

	<img src="https://assets.codepen.io/t-1/lefteris-kallergis-_TLKIVSW6Do-unsplash.jpg" alt="a vegetarian burger with a quinoa patty and lots of vegetable fixins.">
	<!-- photo by Lefteris kallergis for Unsplash. Full-size image at: https://unsplash.com/photos/_TLKIVSW6Do -->
	<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui dicta minus molestiae vel beatae natus eveniet ratione temporibus aperiam harum alias officiis assumenda officia quibusdam deleniti eos cupiditate dolore doloribus!</p>
	<p>Ad dolore dignissimos asperiores dicta facere optio quod commodi nam tempore recusandae. Rerum sed nulla eum vero expedita ex delectus voluptates rem at neque quos facere sequi unde optio aliquam!</p>
	<img src="https://assets.codepen.io/t-1/jay-gajjar-vsYCZVef28E.jpg" alt="french fries seasoned with garlic and spices in a brown craft paper container. ">
	<!-- photo by Jay Gajjar for Unsplash. Full-size image at: https://unsplash.com/photos/vsYCZVef28E -->
	<p>Tenetur quod quidem in voluptatem corporis dolorum dicta sit pariatur porro quaerat autem ipsam odit quam beatae tempora quibusdam illum! Modi velit odio nam nulla unde amet odit pariatur at!</p>
	<img src="https://assets.codepen.io/t-1/melissa-walker-horn-NkwNp3ho-Qw-unsplash.jpg" alt="a burger, fries, and a beer on a restaurant table. ">
	<!-- photo by Melissa Walker Horn for Unsplash. Full size image at: https://unsplash.com/photos/NkwNp3ho-Qw -->
	<p>Consequatur rerum amet fuga expedita sunt et tempora saepe? Iusto nihil explicabo perferendis quos provident delectus ducimus necessitatibus reiciendis optio tempora unde earum doloremque commodi laudantium ad nulla vel odio?</p>
</section>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;400;600;700&display=swap");
*,
*::after,
*::before {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	list-style: none;
}
body {
	font-family: "Poppins", sans-serif;
	overflow-x: hidden;
}

h1 {
	width: 100%;
	padding: 1rem 0;
	display: flex;
	justify-content: center;
	gap: 1rem;
	font-size: calc(1rem + 2vw);
	text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5),
		2px 2px 2px rgba(0, 0, 0, 0.5), 3px 3px 2px rgba(255, 255, 255, 0.7),
		4px 4px 2px rgba(0, 0, 0, 0.7);
	justify-content: center;
	align-items: center;
	background: orange;
	color: white;
}

h1 span {
	text-transform: uppercase;
	font-size: calc(4rem + 2vw);
	font-weight: 700;
	background: url("https://c.tenor.com/AaPeZRxwOuQAAAAC/fire-flames.gif");
	color: transparent;
	text-shadow: 2px 2px 3px rgba(255, 255, 255, 0.2);
	-webkit-background-clip: text;
	-moz-background-clip: text;
	background-clip: text;
	background-size: cover;
}

.menu {
	position: sticky;
	top: 0;
}

.menu > ul {
	position: relative;
	display: inline-flex;
	width: 100%;
	background-color: orange;
	color: white;
	font-weight: 600;
	justify-content: center;
	flex-wrap: wrap;
}
.menu > ul > li {
	cursor: pointer;
	padding: 1rem 2rem;
	transition: ease-in 300ms;
}
.menu > ul > li:hover {
	background-color: #3f3f3f;
}
.menu ul li:hover .sub-menu {
	opacity: 1;
	transform: translatex(0);
	pointer-events: auto;
}
.sub-menu {
	position: absolute;
	background: #3f3f3f;
	width: 100%;
	padding: 1rem 2rem;
	pointer-events: none;
	left: 0;
	right: 0;
	top: 100%;
	opacity: 0;
	transform: translatex(-100%);
	transition: cubic-bezier(0.5, -0.15, 0.56, 1.51) 700ms;
	display: flex;
	justify-content: space-around;
	flex-wrap: wrap;
	gap: 1rem;
}
.sub-menu > li,
.sub-menu > li > ul > li {
	cursor: pointer;
	position: relative;
}
.sub-menu > li {
	padding: 0.5rem 0;
}
.sub-menu > li > ul > li {
	padding: 0.2rem 0;
	margin: 0 0.5rem;
}
.sub-menu > li::after,
.sub-menu > li > ul > li::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 5px;
	background: orange;
	width: 50px;
	transform: scalex(0);
	transition: ease-in 100ms;
}
.sub-menu > li:hover::after,
.sub-menu > li > ul > li:hover::after {
	transform: scalex(1);
}

.grid-2 {
	display: grid;
	grid-template:
		"a a" auto
		"b b" auto;
	justify-content: space-evenly;
	justify-items: start;
	align-items: start;
	align-content: center;
}
.grid-2 > li {
	position: static !important;
	color: orange;
	font-weight: 700;
}
.grid-2 > li > ul > li {
	color: white;
	font-weight: 400;
}
.grid-2 > li::after {
	position: static;
}
.article {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	max-width: 800px;
	margin: 0 auto;
	padding: 0 2rem 2rem 2rem;
}
img {
	border-radius: 1rem;
	box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.5);
	margin: 2rem auto;
	width: 100%;
	height: 400px;
	object-fit: cover;
}
#close,
#menu-icon {
	display: none;
}
@media screen and (max-width: 600px) {
	h1 {
		display: flex;
		gap: 0;
		flex-direction: column;
		background: orange;
		color: white;
	}
	.menu {
		position: fixed;
		transform: translatex(100%);
		transition: ease-in-out 300ms;
		background: orange;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		padding: 1rem;
		height: 100%;
		overflow-y: auto;
	}
	.menu > ul {
		display: flex;
		justify-content: strech;
		align-items: strecht;
		flex-direction: column;
		gap: 1rem;
		margin-top: 2rem;
	}

	.sub-menu {
		position: static;
		opacity: 1;
		transform: translatex(0);
		display: flex;
		flex-direction: column;
	}

	.sub-menu > ul > li {
		padding: 0.5rem;
		border-radius: 0.5rem;
		background: orange;
	}
	.grid-2 {
		display: flex;
		flex-direction: column;
		align-content: flex-start;
	}
	#close {
		display: flex;
		justify-content: center;
		position: absolute;
		top: 0.5rem;
		left: 0.5rem;
		z-index: 1;
		background: #3f3f3f;
		color: white;
		font-weight: 700;
		height: 25px;
		width: 25px;
		border-radius: 50%;
		cursor: pointer;
		transition: ease-in-out 300ms;
	}
	.menu.active {
		transform: translatex(0);
	}

	#menu-icon {
		display: flex;
		justify-content: center;
		cursor: pointer;
		position: fixed;
		top: 0;
		right: 0;
		z-index: 99;
		background: #3f3f3f;
		color: white;
		padding: 0.5rem 1rem;
		border-radius: 0 0 0 0.5rem;
	}
	#menu-icon.active {
		display: none;
	}
	.menu > ul > li {
		background-color: #3f3f3f;
		border-radius: 0.3rem;
	}
}

              
            
!

JS

              
                let menuIcon = document.querySelector("#menu-icon");
let menu = document.querySelector(".menu");
let close = document.querySelector("#close");

menuIcon.addEventListener("click", () => {
	menu.classList.add("active");
	menuIcon.classList.add("active");
});
close.addEventListener("click", () => {
	menu.classList.remove("active");
	menuIcon.classList.remove("active");
});

              
            
!
999px

Console