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

              
                <div class="navbar">
	
	<div class="logo">
		<h2>BRAND</h2>
	</div>
	
	
	<ul class="links">
		<li><a href="#">Home</a></li>
		<li><a href="#">About</a></li>
		<li><a href="#">Pages</a></li>
		<li><a href="#">Contact Us</a></li>
	</ul>
	
	
	<div class="right">
		<button>Dashboard</button>
	</div>
	
	<div class="toggle">
		<div class="line1"></div>
		<div class="line2"></div>
		<div class="line3"></div>
	</div>
	
	
</div>



<main>
	
	<div class="content">
		<h1>Made with Love</h1>
		<h2>by @themahabbat</h2>
	</div>
	
	<section>
		Lorem ipsum dolor sit amet consectetur adipisicing elit. Sequi inventore optio explicabo. Unde tempora, est numquam optio nostrum molestiae hic repudiandae dolorum sunt. Tempore ut dolor voluptate quas impedit vel! Lorem ipsum dolor sit, amet consectetur adipisicing elit. Tenetur dolore minus facilis id! Architecto quia ratione laudantium nam, ipsam assumenda dolorum quod tempora illo blanditiis hic molestiae et, beatae laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores temporibus aliquid odio sed at vel molestias laboriosam ea dolor nihil culpa debitis quas qui, hic quo incidunt excepturi ex recusandae!
	</section>
	
	
	
</main>
              
            
!

CSS

              
                @import url('https://fonts.googleapis.com/css?family=Nunito|Lacquer');

$navbarHeight: 65px;
$sidebarWidth: 45vw;
$primary: #080808;
$secondary: #ffc600;

$bgImage: 'https://images.unsplash.com/photo-1563733758230-a5d441824696?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80';


body {
	margin: 0;
}

body,button,input {
	font-family: Nunito;
}

* {
	box-sizing: border-box;
	transition: 0.4s ease all;
}

h1,h2,h3,h4,h5,h6 {
	margin: 0;
}


ul {
	padding: 0;
	margin: 0;
}



.navbar {
	background: $primary;
	color: #fff;
	padding: 15px;
	width: 100%;
	height: $navbarHeight;
	
	display: flex;
	align-items: center;
}

.navbar .logo {
	cursor: pointer;
	font-family: Lacquer;
}


.navbar ul.links {
	
	margin-left: auto;
	margin-right: 50px;
	list-style: none;
	
	display: flex;
	align-items: center;
	
	transition: 0.4s ease all, 0s ease background;
	
	li {
		text-transform: uppercase;
		padding: 0 15px;
		height: $navbarHeight;
		
		display: flex;
		justify-content: center;
		align-items: center;
		
		transition: 0.4s ease all, 0s ease margin;
		
		a {
			text-decoration: none;
			color: #fff;
		}
		
		&:hover {
			background: $secondary;
			cursor: pointer;
			
			a {
				color: #080808;
			}
			
		}
		
		
	}
	
}


button {
	background: $secondary;
	outline: none;
	font-weight: bold;
	padding: 10px 18px;
	border-radius: 25px;
	border: 1px solid darken($secondary,5%);
	letter-spacing: 1px;
	
	
	&:hover {
		cursor: pointer;
		transform: scale(1.1);
		color: white;
		background: lighten(#080808,10%);
		border-color: darken($primary,5%);
	}
	
}



.content {
	background: url($bgImage) no-repeat;
	background-size: cover;
	height: calc(100vh - #{$navbarHeight});
	
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	
	color: #fff;
	
	h2 {
		color: $secondary;
	}
	
}


.navbar.sticky {
	position: fixed;
	z-index: 40;
	
	
	~ main {
		position: relative;
		z-index: 20;
		top: $navbarHeight;
	}
	
}

section {
	background: #000;
	color: $secondary;
	padding: 20px;
	font-family: Lacquer;
	font-weight: bold;
	letter-spacing: 0.5px;
}


// RESPONSIVE

@media screen and (max-width: 750px){
	
	
	.navbar .right {
		height: 0;
		overflow: hidden;
	}
	
	
	.toggle {
		position: absolute;
		top: $navbarHeight / 2;
		right: 20px;
		z-index: 99;
		
		transform: translateY(-50%);
		
		cursor: pointer;
		width: 40px;
		height: 40px;
		
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		
		
		> * {
			width: 80%;
			height: 2px;
			background: #fff;
			margin: 3px 0;
		}
		
	}
	
	.navbar.collapsed .toggle {
		
		.line1 {
			transform: rotate(-45deg) translate(-4px,5px);
		}
		
		.line2 {
			opacity: 0;
		}
		
		.line3 {
			transform: rotate(45deg) translate(-5px,-6px);
		}
		
	}
	
	
	.navbar.collapsed .logo {
		position: absolute;
		z-index: 44;
	}
	
	.navbar .links {
		position: fixed;
		background: #080808;
		z-index: 40;
		top: 0;
		left: -100%;
		flex-direction: column;
		width: $sidebarWidth;
		height: 100vh;
		
		li:first-child {
			margin-top: 80px;
		}
		
	}
	
	.navbar.collapsed .links {
		left: 0;
		
		a {
			color: #fff;
		}
		
		li {
			width: 100%;
			
			&:hover a {
				color: #080808;
			}
			
		}
		
		
	}
	
	.navbar.collapsed .right {
		position: fixed;
		width: $sidebarWidth;
		text-align: center;
		height: auto;
		bottom: 40px;
		left: $sidebarWidth/2;
		transform: translateX(-50%);
		z-index: 45;
	}
	
	
	
	.navbar.collapsed {
		
		~ main {
			filter: blur(1px);
			opacity: 0.8;
		}
		
	}
	
	
	.navbar.sticky {
		position: fixed;
		z-index: 40;
	}
	
	
	
	
	
	
	
	
	
	
	
	
}
              
            
!

JS

              
                const navbar = document.querySelector('.navbar')

navbar.querySelector('.toggle').addEventListener('click',()=>{
	
	navbar.classList.toggle('collapsed')
	
})



window.addEventListener('scroll',(e)=>{
	
	let windowY = window.pageYOffset
	
	let navbarHeight = document.querySelector('.navbar').offsetHeight
	
	if(windowY>navbarHeight) navbar.classList.add('sticky')
	else navbar.classList.remove('sticky')
	
	
	
	
})
              
            
!
999px

Console