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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

HTML

              
                <nav class="nav-bar">
	<div class="container">
		<input type="checkbox" id="drop-down-cbox"/>
		<label for="drop-down-cbox">
			<span></span>
			<span></span>
			<span></span>
		</label>

		<h1 class="site-logo">Homepage</h1>

		<ul class="main-nav small-caps">
			<li><a href="#">Home</a></li>
			<li><a href="#">About</a></li>
			<li><span>List of Work</span>
				<ul>
					<li><a href="#">Codepen</a></li>
					<li><a href="">Behance</a></li>
					<li><a href="#">Github</a></li>
				</ul>
			</li>
			<li><a href="#">Contact</a></li>
		</ul>
		
	</div>
</nav>
              
            
!

CSS

              
                /* --- Default Overrides - Personal Preference --- */


*,
*:before,
*:after {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

form > * {
	outline: none;
}

a {
	text-decoration: none;
	color: inherit;
}

ul, li {
	list-style: none;
}


/* --- Clearfix for floated Elements --- */

/* I never ended up using this for the nav-bar */
.clearfix:after {
  visibility: hidden;
  display: block;
  font-size: 0;
  content: " ";
  clear: both;
  height: 0;
}


/* --- Typography --- */


body {
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	background-color: #eee;
	color: #666;
	margin-top: 60px; /* height of nav-bar */
}

p {
	line-height: 1.4;
}

.small-caps {
	text-transform: uppercase;
	letter-spacing: 0.15rem;
	font-size: 0.7rem;
}

.bolder {
	font-weight: bolder;
}

.lighter {
	font-weight: lighter;
}

.text-center {
	text-align: center;
}

.site-logo {
	font-size: 2rem;
	font-weight: bolder;
	text-transform: uppercase;
	letter-spacing: 0.8rem;
	margin: 0 1rem;
}

/* --- Elements --- */


.container {
	max-width: 1200px; /* max 'width' of contents of site */
	margin: 0 auto; /* centered horizontally  */
}

.nav-bar {
	position: fixed; /* lock to top */
	top: 0;
	width: 100%; /* full width */
	background-color: white;
	height: 60px;
}

.nav-bar .container {
	display: flex;
	align-items: center; /* vertically center */
	height: 100%;
}

/* Hide checkbox that controls Mobile Nav Button*/
#drop-down-cbox {
	display: none;
}

/* Mobile Nav Button */
#drop-down-cbox + label {
	position: relative;
	display: none;
	width: 60px;
	height: 60px;
	overflow: hidden;
	background-color: transparent;
	transition: all 300ms ease-in-out;
}

/* Mobile Nav Button Bars */
#drop-down-cbox + label span {
	position: absolute;
	display: block;
	background-color: #666;
	width: 34px;
	height: 4px;
	border-radius: 2px;
	left: 50%;
	transform: translate(-50%, -50%); /* centering trick */
	transition: all 300ms ease-in-out;
}

/* Mobile Nav Button Bars Invididually */
#drop-down-cbox + label span:nth-child(1) {
	top: 35%; /* evenly spaced */
}
#drop-down-cbox + label span:nth-child(2) {
	top: 50%; /* evenly spaced */
}
#drop-down-cbox + label span:nth-child(3) {
	top: 65%; /* evenly spaced */
}

/* Mobile Nav Button Styling for Checked */
#drop-down-cbox:checked + label {
	background-color: #666;
}

#drop-down-cbox:checked + label span {
	background-color: white;
}

/* Transform the bars into an 'X' */
#drop-down-cbox:checked + label span:nth-child(1) {
	top: 50%;
	transform: translate(-50%, -50%) rotate(45deg); /* center, then rotate */
}
#drop-down-cbox:checked + label span:nth-child(2) {
	left: -150%; /* move center bar out of the picture */
}
#drop-down-cbox:checked + label span:nth-child(3) {
	top: 50%;
	transform: translate(-50%, -50%) rotate(-45deg); /* center, then rotate */
}

/* Main Nav Desktop */
.main-nav {
	flex-grow: 1; /* fill remaining space */
	display: flex;
	justify-content: space-around; /* evenly space items */
	align-items: center; /* center vertically */
}

.main-nav li {
	display: block;
	width: 100%;
	height: 60px;
	line-height: 60px; /* vertically center text, matches height */
	text-align: center;
}

.main-nav li a,
.main-nav li span {
	display: block;
	width: 100%;
	height: 100%;
}

.main-nav li a:hover,
.main-nav li span:hover {
	border-bottom: 4px solid #666;
}

.main-nav li > ul {
	max-height: 0px; /* max-height instead of height, height can't transition to auto */
	transition: all 500ms ease-in-out;
	overflow: hidden; /* make it so nav doesn't show beyond the 0px max-height */
}

.main-nav li:hover > ul {
	max-height: 180px; /* height x how many links */
	height: auto;
}

.main-nav li > ul li a,
.main-nav li > ul li span {
	background-color: white;
}

.main-nav li > ul li a:hover,
.main-nav li > ul li span:hover {
	background-color: #666;
	color: white;
	border-bottom: none;
}

/* Tablet and Mobile View */
@media (max-width: 768px) {
	.site-logo {
		font-size: 1.5rem;
		flex-grow: 1;
		text-align: center;
	}
	
	#drop-down-cbox + label {
		display: block; /* unhide the mobile nav button */
	}
	
	.main-nav {
		max-height: 0px; /* same vertical grow transition trick as above */
		height: calc(100vh - 60px); /* take full vertical viewport height, -60px for nav-bar */
		overflow: hidden;
		position: absolute;
		top: 60px;
		line-height: auto;
		left: 0;
		width: 100%;
		flex-direction: column;
		background-color: white;
		transition: all 500ms ease-in-out;
	}
	
	#drop-down-cbox:checked ~ .main-nav {
		max-height: calc(100vh - 60px);
		transition: all 500ms ease-in-out;
	}

	.main-nav li span {
		position: relative;
	}
	
	/* design and position downward arrow */
	.main-nav li span:after {
		content: "";
		width: 6px;
		height: 6px;
		position: absolute;
		top: 50%;
		margin-top: -2px;
		margin-left: 8px;
		transform: translateY(-50%) rotate(-45deg);
		border-left: 2px solid #666;
		border-bottom: 2px solid #666;
	}
	
	.main-nav li a:hover,
	.main-nav li span:hover {
		background-color: #666;
		color: white;
		border-bottom: none;
	}
	
	.main-nav li > ul li {
		position: relative;
	}
	
	.main-nav li > ul li a,
	.main-nav li > ul li span {
		background-color: #eee;
	}
	
}

              
            
!

JS

              
                
              
            
!
999px

Console