Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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

Auto Save

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

              
                	<input type="checkbox" id="show-menu" role="button">

	<ul id="menu">
		<li><a href="#about">About Me</a></li>
		<li><a href="#portfolio">Portfolio</a></li>
		<li><a href="#blog">Blog</a></li>
	</ul>

	<div id="wrapper">

		<header>
      
        <!-- clicking this label will check and uncheck the checkbox -->
			<label for="show-menu">Menu</label>

			<h1>Mobile Push Menu With CSS</h1>
			<p>Click on the word Menu above to open or close the menu.</p>
      
        <p>This pure CSS push-down menu is simple to code but it has its limits. The menu doesn't close when you click a link. Part of the problem is that a checkbox has only two states, checked and unchecked. Also these states can only be toggled by clicking on the checkbox or (one of) its label(s).</p>
		</header>

		<section id="about">
			<h2>About Me</h2>
			
		</section>

		<section id="portfolio">
			<h2>Portfolio</h2>
			
		</section>

		<section id="blog">
			<h2>Blog</h2>
			
		</section>

	</div>
              
            
!

CSS

              
                
/* Hide Checkbox */
#show-menu {
	display: none;
}

/* Put menu above canvas and set up transition */
#menu {
	position: absolute;
	top: -5em;

	-webkit-transition: top .3s ease-in;
	transition: top .3s ease-in;

}

/* Place menu at top */
#wrapper {
	position: relative;
	top: 0;

	-webkit-transition: top .3s ease-in;
	transition: top .3s ease-in;
}


/* change position of both when checkbox is clicked */
#show-menu:checked ~ #wrapper {
	top: 5em;
}
#show-menu:checked ~ #menu {
	top: 0;
}





/* Unnecessary styling stuff */
#menu {
  background-color: #FAD89B;
  width: calc(100% - 56px);
}
header, section {
	height: 500px;
}
header {
	background-color: #B598A2;
}
#about {
	background-color: #73799E;
}
#portfolio {
	background-color: #809E90;
}
#blog {
	background-color: #BCBD9C;
}
              
            
!

JS

              
                
              
            
!
999px

Console