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. 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

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

              
                <main>
	<input id="home" type="radio" name="menu" checked="checked"/>
	<section>
		<h3>JavaScript</h3>
		<h1>free</h1>
		<h4>off-canvas</h4>
		<h2>menu</h2>
	</section>
	
	<input id="how" type="radio" name="menu"/>
	<section>
		<article>
			<span><h3>But how?!</h3></span>
			<span><h1>radio<br/>buttons.</h1></span>
			<span><h4>honestly<br/>they're</h4> <h2>everywhere</h2></span>
			<span><h5>It turns out that&nbsp;</h5> <h6>a radio input's</h6> <h4>&nbsp;label will</h4></span>
			<span><p><b>still</b> check it off</p> <h5>even when there's</h5> <p><b>no <u><s>common</s></u> parent.</b></p></span>
			<span><h2>- all YOU</h2> <h1>need</h1> <h4>to<br/>do</h4></span>
			<span><p>is place the <em>input</em></p> <p><b>immediately before</b></p> <p>its corresponding section.</p></span>
			<span><h2>CSS</h2> <h1>+</h1> <h4>selector takes care<br/><b>of the <u>rest</u></b>.</h4></span>
		</article>
	</section>
	
	<input id="why" type="radio" name="menu"/>
	<section>
		<article>
			<span><h3>But why!?</h3></span>
			<span><h1>mostly</h1> <h2>just</h2> <h4>for<br/>fun.</h4></span>
			<span><h4>besides keeping me<br/>busy last weekend</h4> <h2>it offers</h2></span>
			<span><h6>benefits <b>including</b></h6> <h4>(but not limited to)</h4></span>
			<span><h1>stability</h1></span>
			<span>&nbsp;<h2>portability</h2></span>
			<span><h1>&amp;</h1> <p><em><u>versatilit</u>y.</em></p></span>
		</article>
	</section>
	
	<input id="semantics" type="radio" name="menu"/>
	<section>
		<article>
			<span><h3>But semantics!!</h3></span>
			<span><h2>oh...</h2> <h1>yeah...</h1> <h4><em>about<br/>that...</em></h4></span>
			<span><h5><em>Holy cow!</em></h5> <h4>&nbsp;Check out this&nbsp;</h4> <h3><b>amazing</b></h3></span>
			<span><h6><em>svg path&nbsp;</em> <u><s>animation</s></u></h6> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 320"><g><path class="orange" d="m320.332 174.25c0 0 53.59 105.839 162.621 105.608 145.539-.309 141.489-239.6394-4.525-239.853-130.462-.1909-169.6 234.495-300.193 239.853-172.94203 7.095-167.6333-237.2565-4.526-239.853 101.036-1.6084 146.623 134.245 146.623 134.245" fill="none" stroke="#f7b37f" stroke-linecap="miter" stroke-width="60" stroke-miterlimit="2"/><path class="white" d="m320.332 174.25c0 0 53.59 105.839 162.621 105.608 145.539-.309 141.489-239.6394-4.525-239.853-130.462-.1909-169.6 234.495-300.193 239.853-172.94203 7.095-167.6333-237.2565-4.526-239.853 101.036-1.6084 146.623 134.245 146.623 134.245" fill="none" stroke="#fff" stroke-linecap="miter" stroke-width="60" stroke-miterlimit="2"/><path class="black" d="m320.332 174.25c0 0 53.59 105.839 162.621 105.608 145.539-.309 141.489-239.6394-4.525-239.853-130.462-.1909-169.6 234.495-300.193 239.853-172.94203 7.095-167.6333-237.2565-4.526-239.853 101.036-1.6084 146.623 134.245 146.623 134.245" fill="none" stroke="#3f3f37" stroke-linecap="miter" stroke-width="63" stroke-miterlimit="2"/></g></svg></span>
			<p>(ps. Still no JavaScript)</p>
		</article>
	</section>
	
	<input id="udy" type="radio" name="menu"/>
	<section>
		<article>
			<span><h3>Who's Udy??</h3></span>
			<span><h2>That's me!</h2></span>
			<span><h2><u><s>I'm</s></u> a</h2> <h5><s>front–end</s><br/><em>developer</em></h5></span>
			<span><h1>from</h1> <h4><u><b>Québec</b></u><br/>Canada</h4> <h2>who</h2></span>
			<span><h2>(</h2> <h4>now quite<br/>ironically</h4> <h2>)</h2> <h5>likes to spend his time<br/><b>writing</b> <u><s>JavaScript</s></u></h5></span>
			<span><h4>check out <b>my</b></h4> <h6><a href="https://codepen.io/udyux/" target="_blank"><s>profile</s></a></h6> <u><h5>for more pens.</h5></u></span>
		</article>
	</section>
	
	<label for="menu">menu</label>
	<input type="radio" name="menu" id="menu"/>
	<menu>
		<nav>
			<label for="home">jsfocm!</label>
			<label for="how">but how?!</label>
			<label for="why">but why!?</label>
			<label for="semantics">but semantics!!</label>
			<label for="udy">who's udy??</label>
		</nav>
	</menu>
</main>
              
            
!

CSS

              
                /*	RADIO-MENU STUFF
   ∞∞ STARTS HERE ∞∞
*/
body {background-image: linear-gradient(to bottom right, #ba532e, #ff934c 90%)}
main {
	width: 100%;
	height: 100%;
	color: white;
	font-weight: 300;
	input[name='menu'] {display: none}
}

/* sections *//* keep them off canvas */
section {
	transition: bottom 0ms linear 900ms, opacity 900ms cubic-bezier(.4,.25,.3,1);
	width: 100%;
	height: 100%;
	position: absolute;
	bottom: 100%;
	left: 0;
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: center;
	opacity: 0;
	overflow-x: hidden;
	overflow-y: scroll;
	&:first-of-type {justify-content: center}
	article {
		min-height: 740px;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: flex-end;
		span {
			width: 100%;
			display: flex;
			justify-content: space-between;
			align-items: flex-end;
			white-space: nowrap;
		}
	}
}

/* menu *//* this goes off canvas as well */
menu {
	transition: bottom 0ms linear 1000ms, background-color 1000ms cubic-bezier(.4,.25,.3,1);
	width: 100vw;
	height: 100vh;
	position: fixed;
	bottom: 100%;
	left: 0;
	color: #3f3f37;
	background-color: hsla(0,0%,100%,0);
	nav {
		transition: all 500ms cubic-bezier(.4,.25,.3,1) 250ms;
		width: 100%;
		height: 250%;
		position: absolute;
		bottom: 100%;
		left: 0;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		align-items: center;
		font-size: .5rem;
		label {
			line-height: 40px;
			text-transform: uppercase;
			cursor: pointer;
			&::before,
			&::after {
				content: '';
				transition: all 300ms cubic-bezier(.4,.25,.3,1);
				width: 100%;
				height: 2px;
				position: absolute;
				left: 0;
				background-color: #f7b37f;
				opacity: 0;
			}

			&::before {top: -.5rem}
			&::after {bottom: -.5rem}
			&:hover::before,
			&:hover::after {opacity: 1}
			&:hover::before {top: 0}
			&:hover::after {bottom: 0}
		}
	}
}


/* menu button */
label[for='menu'] {
	transition: opacity 300ms cubic-bezier(.4,.25,.3,1) 900ms;
	display: inline-block;
	position: fixed;
	top: 30px;
	left: 100px;
	line-height: 40px;
	font-size: 1.3rem;
	font-weight: 900;
	text-transform: uppercase;
	cursor: pointer;
	&::before,
	&::after {
		content: '';
		transition: all 300ms cubic-bezier(.4,.25,.3,1);
		width: 100%;
		height: 2px;
		position: absolute;
		left: 0;
		background-color: white;
	}

	&::before {top: 0}
	&::after {bottom: 0}
	&:hover::before {top: -.25rem}
	&:hover::after {bottom: -.25rem}
}

/* menu toggle *//* click the label > checks the radio > toggles the menu */
#menu:checked + menu {
	transition: background-color 800ms cubic-bezier(.4,.25,.3,1);
	bottom: 0;
	background-color: hsla(0,0%,100%,1);
	nav {
		transition: all 500ms cubic-bezier(.4,.25,.3,1) 250ms;
		height: 70%;
		bottom: 15%;
		font-size: 1.7rem;
	}
}

/* section change *//* click the label > check the radio > change the section */
input[name="menu"]:checked + section {
	transition: opacity 900ms cubic-bezier(.4,.25,.3,1);
	bottom: 0;
	opacity: 1;
}
/*	RADIO-MENU STUFF
    ∞∞ ENDS HERE ∞∞
*/

/* the rest is just content */
h1,
h2,
h3,
h4,
h5,
em,
p,
b {font-weight: 900}

h1,
h4,
h6,
b {text-transform: uppercase}

h2,
h6,
b {color: #3f3f37}

h1,
h5 {color: #f7b37f}

h5,
h6 {font-size: 2.2rem}

em {font-size: 1.2em}
h1 {font-size: 6.9rem}
h2 {font-size: 6.4rem}
h4 {font-size: 2.45rem}
p {font-size: 1.5rem}

h3 {
	font-size: 3.25rem;
	text-decoration: underline;
}

s {
	text-decoration: none;
	color: white;
	font-size: 1.1em;
}

/* landing */
section:first-of-type {
	h1 {margin-top: -12px}
	h2 {margin-top: -38px}
	h4 {margin-top: -5px;
		&::after {
			content: '';
			width: 100%;
			height: 4px;
			position: absolute;
			top: 0;
			left: 0;
			background-color: white;
		}
	}
}

/* how */
section:nth-of-type(2) {
	h4 {margin-bottom: -2px}
	span:nth-child(2) h1 {
		margin-left: -5px;
		line-height: .79;
		&::after {
			content: '';
			width: 99%;
			height: 4px;
			position: absolute;
			bottom: -10px;
			left: 5px;
			background-color: white;
		}
	}
	
	span:nth-child(3) {
		margin: -20px 0 15px;
		h2 {margin-bottom: 13px}
		h4 {
			margin-bottom: 20px;
			line-height: .79;
		}
	}
	
	span:nth-child(5) {
		margin-bottom: 35px;
		h5 {margin-bottom: -2px}
	}
	
	span:nth-child(6) {
		margin: -10px 0 5px;
		h4 {margin-bottom: 13px}
	}
	
	span:nth-last-child(2) {margin-top: -13px}
	
	span:last-child {
		margin-top: -15px;
		h4 {margin-bottom: 10px}
	}
}

/* why */
section:nth-of-type(3) {
	h1,
	h4,
	h5 {line-height: .79}
	h1 {margin-left: -5px}
	h2 {margin-bottom: -10px}
	h5 {margin-bottom: 5px}
	h6 {margin: 0 0 -2px -3px}
	span:nth-child(3) {margin-top: -13px}
	span:nth-child(4) {margin-top: 15px}
	span:nth-child(5) {
		margin-top: 20px;
		h1::after {
			content: '';
			width: 100%;
			height: 3px;
			position: absolute;
			top: -3px;
			left: 0;
			background-color: white;
		}
	}

	span:nth-child(6) {margin-top: -25px}
	span:last-child {
		margin: -20px -28px 0 0;
		justify-content: center;
		p {
			margin: 0 0 -3px -3px;
			font-size: 3.8rem;
		}
	}
}

/* semantics */
section:nth-of-type(4) {
	span:first-child {margin-bottom: -10px}
	h1 {margin-left: -30px}
	span:nth-child(2) h4 {
		margin-bottom: 8px;
		line-height: .9;
	}
	
	span:last-of-type h6 {transform: translateY(-125%)}
	p:last-child {margin-right: 30px}
	
	svg {
		width: 300px;
		height: auto;
		margin-top: 20px;
		path {
			animation-play-state: paused;
			&.black {
				animation: draw 5s cubic-bezier(.4,.25,.3,1) infinite;
				stroke-dashoffset: 0;
				stroke-dasharray: 1569.27294921875;
			}
			&.orange {
				animation: pathA 20s linear infinite;
				opacity: 0;
			}
			&.white {
				animation: pathB 20s linear infinite;
				opacity: 0;
			}
		}
	}
}

input[name="menu"]:checked + section path {animation-play-state: running}

/* udy */
section:last-of-type {
	span:nth-child(3){
		margin-top: -15px;
		h2 {margin-left: 8px}
		h5 {
			margin: 0 240px 10px 0;
			line-height: .8;
		}
	}
	
	span:nth-child(4) {
		h4 {
			margin: 0 0 7px 15px;
			line-height: 1.2;
		}
	}
	
	span:nth-child(6) {
		margin-top: 35px;
		u {margin-bottom: 4px}
	}
}

/* animations */
@keyframes draw {
	0% {stroke-dashoffset: 0}
	100% {stroke-dashoffset: 3138.54589844}
}

@keyframes pathA {
	0% {opacity: 0}
	24% {opacity: 0}
	25% {opacity: 1}
	99% {opacity: 1}
	100% {opacity: 0}
}

@keyframes pathB {
	0% {opacity: 0}
	49% {opacity: 0}
	50% {opacity: 1}
	74% {opacity: 1}
	75% {opacity: 0}
	100% {opacity: 0}
}
              
            
!

JS

              
                // 404? Nope, just nothing here.
              
            
!
999px

Console