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

              
                <header>
	<h1 id="title">Mobile Nav</h1>
	
	<div id="toggle-open" class="navbar-toggle">
		<span class="toggle-bar top-bar"></span>
		<span class="toggle-bar middle-bar"></span>
		<span class="toggle-bar bottom-bar"></span>
	</div>
	
	<nav>
		<ul id="main-nav">
			<li id="toggle-close" class="nav-item navbar-toggle">
				<span class="toggle-bar top-bar"></span>
				<span class="toggle-bar middle-bar"></span>
				<span class="toggle-bar bottom-bar"></span>
			</li>
			<li class="nav-item">
				<a class="nav-link" href="#">Home</a>
			</li>
			<li class="nav-item">
				<a class="nav-link" href="#">About</a>
			</li>
			<li class="nav-item">
				<a class="nav-link" href="#">Services</a>
			</li>
			<li class="nav-item">
				<a class="nav-link" href="#">Testimonials</a>
			</li>
			<li class="nav-item">
				<a class="nav-link" href="#">Contact</a>
			</li>
		</ul>
	</nav>
</header>

<div id="tidy-blog">
	<h2>Tidy Design Tutorial</h2>
	<p>Check out our previous blog posts:</p>

	<div class="posts">
		<a class="post" href="https://www.tidydesign.com/blog/2018/09/creating-a-responsive-svg-overlay/">
			<div class="post-photo"></div>
			<span class="post-title">Creating a Responsive SVG Overlay</span>
		</a>

		<a class="post" href="https://www.tidydesign.com/blog/2018/08/creating-a-cut-out-text-effect/">
			<div class="post-photo"></div>
			<span class="post-title">Creating a Cut Out Text Effect</span>
		</a>
	</div>
</div>
              
            
!

CSS

              
                /* Tutorial Styles */
header {
posrel
}
/* Nav Container */
nav {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 0;
	transition-property: height;
	transition-duration: 0s;
	transition-delay: 1.15s;
	overflow: hidden;
	z-index: 10;
}

/* Nav "Curtains" */
nav::before,
nav::after {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	width: 50%;
	background-color: #2b2b2b;
	transition-property: transform;
	transition-duration: .5s;
	transition-delay: .65s;
	transition-timing-function: ease-out;
	z-index: 5;
}
/* Left Curtain */
nav::before {
	transform: translate(-100%);
}
/* Right Curtain */
nav::after {
	right: 0;
	transform: translate(100%);
}

/* Nav ul */
#main-nav {
	display: flex;
	flex-direction: column;
	justify-content: space-evenly;
	align-items: center;
	height: 100%;
	transition-property: padding;
	transition-duration: 0s;
	transition-delay: 1.15s;
	z-index: 10;
	visibility: hidden;	
}

/* Nav li's */
.nav-item {
	opacity: 0;
	transition-property: all;
	transition-duration: .5s;
	transition-delay: 0s;
	z-index: 10;
}

/* Nav Close Toggle */
#toggle-close {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: flex-start;
	width: 18px;
	height: 20px;
}

/* Open Styles */
/* Nav Container */
.nav-open {
	height: 100%;
	transition-duration: 0s;
	transition-delay: 0s;
}

/* Nav Curtains */
.nav-open::before,
.nav-open::after {
	transform: translate(0);
	transition-delay: 0s;
}
/* Adds padding to nav ul, adding it before shows the element with nav closed */
.nav-open #main-nav {
	padding: 20% 0;
	transition-delay: 0s;
}

/* Nav li's */
.nav-open .nav-item {
	opacity: 1;
	transition-delay: .65s;
	visibility: visible;
}


/*******************************
********************************
*******************************/

/* PAGE SET UP */
*,::after,::before {
	box-sizing: border-box;
}

body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: auto;
	overflow-x: hidden;
}

ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Header Styles */
header {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 650px;
	background-image: linear-gradient(-14deg, rgba(0, 19, 39,.45), rgba(24, 24, 24,.65)),
							url('https://images.unsplash.com/photo-1502033491742-0e11fb057e16?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=9bc0ec5be8f30ca2719b36ca0b270159&auto=format&fit=crop&w=2089&q=80');
	background-size: cover;
	background-position: 44.5% center;
}

#title {
	font-size: 2.5rem;
	letter-spacing: 2.5px;
}
#title,
.nav-link {
	font-family: 'Overlock', cursive;
	color: #fff;
}
.nav-link {
	font-size: 1.15rem;
	font-weight: 700;
}

/* Hamburger */
#toggle-open {
	position: absolute;
	top: 1em;
	right: 1em;	
}
.navbar-toggle {
	padding: 0;
	background: none;
	border: none;
	outline: none;
	cursor: pointer;
	z-index: 10;
}
.toggle-bar {
	display: block;
	width: 25px;
	height: 2px;
	background: #fff;
	border-radius: 1px;
	transform-origin: left;
}
.toggle-bar:nth-child(1) {
	margin-bottom: 5px;
	transform-origin: 10% 10%;
}
.toggle-bar:nth-child(3) {
	margin-top: 5px;
	transform-origin: 10% 90%;
}

/* Nav Close */
#toggle-close .top-bar {
	transform: rotate(45deg);
}
#toggle-close .middle-bar {
	opacity: 0;
}
#toggle-close .bottom-bar {
	transform: rotate(-45deg);
}

h1, h2 {
	text-transform: uppercase;
}

/* Tidy Blog Information */
#tidy-blog {
	padding: 0 1em;
}

h2 {
	margin-top: 1.25em;
	font-size: 1.75rem;
}

h2, p {
	font-family: 'Montserrat', sans-serif;
	text-align: center;
}

h2, a {
	color: #3086B9;
}

p {
	line-height: 1.6;
}

a {
	text-decoration: none;
}

/* Post Boxes */
.posts {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	max-width: 1200px;
	margin: 0 auto;
}
.post {
	display: block;
	width: 100%;
	max-width: 400px;
	margin: 0 auto 1.5em;
	background-color: #3086b9;
	border-radius: 8px;
	overflow: hidden;
	transition: all .45s;
	text-align: center;
}
.post:hover {
	transform: scale(1.025);
}
.post-photo {
	padding-bottom: 53.5%;
	background-position: center;
	background-size: cover;
}
.post:nth-of-type(1) .post-photo {
	background-image: url('https://www.tidydesign.com/blog/wp-content/uploads/2018/09/waves-12.jpg');
}
.post:nth-of-type(2) .post-photo {
	background-image: url('https://www.tidydesign.com/blog/wp-content/uploads/2018/08/cutout-2.jpg');
}
.post-title {
	display: block;
	padding: 1em .5em;
	color: #fff;
}

@media screen and (min-width: 768px) {
	h2 {
		font-size: 3rem;
		margin-bottom: .35em;
	}
	
	.posts {
		margin: 2em auto;
	}
	.post {
		max-width: 540px;
		width: 48%;
	}
	
	.nav-open #main-nav {
		padding: 10% 0;
	}
}
              
            
!

JS

              
                $('.navbar-toggle').click(function() {
	$('nav').toggleClass('nav-open');
});
              
            
!
999px

Console